YTSFlix_Go/Dockerfile

35 lines
622 B
Docker

# Build
FROM golang:alpine as builder
RUN apk add --no-cache git ca-certificates && \
mkdir /build
WORKDIR /ytsflix
COPY go.mod .
RUN go get -u github.com/gobuffalo/packr/... && \
packr
RUN go mod download
ADD . .
RUN CGO_ENABLED=0 packr build -v -o /build/ytsflix cmd/ytsflix/main.go
# Create Container's Image
FROM scratch
# Copy certs from alpine to avoid "x509: certificate signed by unknown authority"
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /build/* /bin/
ENV LOG_LEVEL=INFO
ENV DATA_DIR=/downloads
VOLUME /download
EXPOSE 8080
CMD ["ytsflix"]