Create release docker image without shipping source and go toolchain. (#188)

* Create release docker image without shipping source and go toolchain.
Closes #185

* Explicitly add ca-certificates to image

* Combine apk run commands

* Update scripts/Dockerfile-build

Co-authored-by: Aaron Ogle <geekgonecrazy@users.noreply.github.com>

Co-authored-by: Aaron Ogle <geekgonecrazy@users.noreply.github.com>
This commit is contained in:
Gabe Kangas 2020-09-26 00:44:43 -07:00 committed by GitHub
parent ec9f8ba004
commit c9d6366b3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,9 @@
FROM golang:alpine
# Perform a build
FROM golang:alpine AS build
EXPOSE 8080 1935
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN apk add --no-cache ffmpeg ffmpeg-libs
RUN mkdir /build
ADD . /build
WORKDIR /build
RUN apk update && apk add --no-cache gcc build-base linux-headers
ARG VERSION
@ -15,5 +15,15 @@ ENV NAME=${NAME}
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags "-extldflags \"-static\" -s -w -X main.GitCommit=$GIT_COMMIT -X main.BuildVersion=$VERSION -X main.BuildType=$NAME" -o owncast .
# Create the image by copying the result of the build into a new alpine image
FROM alpine
RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates && update-ca-certificates
# Copy owncast assets
WORKDIR /app
COPY --from=build /build/owncast /app/owncast
COPY --from=build /build/config.yaml /app/config.yaml
COPY --from=build /build/webroot /app/webroot
COPY --from=build /build/static /app/static
CMD ["/app/owncast"]