50 lines
1.1 KiB
Docker
50 lines
1.1 KiB
Docker
ARG GOLANG_VERSION="1.20.11"
|
|
ARG DEBIAN_VERSION="bookworm"
|
|
ARG YTDLP_VERSION="2023.12.30"
|
|
|
|
FROM golang:${GOLANG_VERSION}-${DEBIAN_VERSION} AS build
|
|
|
|
ENV VERSION_PKG="go.fifitido.net/ytdl-web/version"
|
|
ARG VERSION=latest
|
|
ARG BUILD="unknown"
|
|
ARG BUILD_DATE="unknown"
|
|
ARG BUILT_BY="docker"
|
|
|
|
WORKDIR /app
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN go build \
|
|
-ldflags=" \
|
|
-X $VERSION_PKG.Version=$VERSION \
|
|
-X $VERSION_PKG.Build=$BUILD \
|
|
-X $VERSION_PKG.BuildDate=$BUILD_DATE \
|
|
-X \"$VERSION_PKG.BuiltBy=$BUILT_BY\" \
|
|
" -o /ytdl-web .
|
|
|
|
FROM debian:${DEBIAN_VERSION}
|
|
|
|
WORKDIR /app
|
|
|
|
# hadolint ignore=DL3008
|
|
RUN apt-get update \
|
|
&& apt-get install --no-install-recommends -y wget \
|
|
&& wget --progress=dot:giga "https://github.com/yt-dlp/yt-dlp/releases/download/$YTDLP_VERSION/yt-dlp_linux" \
|
|
&& install -pm755 yt-dlp_linux /usr/bin/yt-dlp \
|
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=build /ytdl-web ./
|
|
|
|
EXPOSE 8080
|
|
|
|
ENV YTDL_HTTP_PORT=8080 \
|
|
YTDL_HTTP_LISTEN=0.0.0.0 \
|
|
YTDL_BINARYPATH=/usr/bin/yt-dlp \
|
|
YTDL_CONFIGDIR=/config
|
|
|
|
ENTRYPOINT [ "./ytdl-web" ]
|