42 lines
842 B
Docker
42 lines
842 B
Docker
ARG GOLANG_VERSION="1.20.5"
|
|
ARG ALPINE_VERSION="3.18"
|
|
|
|
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS build
|
|
|
|
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}" \
|
|
-ldflags="-X $VERSION_PKG.Build=${BUILD}" \
|
|
-ldflags="-X $VERSION_PKG.BuildDate=${BUILD_DATE}" \
|
|
-ldflags="-X $VERSION_PKG.BuiltBy=${BUILT_BY}" \
|
|
-o /ytdl-web .
|
|
|
|
FROM alpine:${ALPINE_VERSION}
|
|
|
|
WORKDIR /app
|
|
|
|
ARG YTDLP_VERSION="2023.07.06-r0"
|
|
RUN apk add --no-cache yt-dlp==${YTDLP_VERSION}
|
|
|
|
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" ] |