mirror of
https://github.com/owncast/owncast.git
synced 2025-01-10 18:47:32 +03:00
c9d6366b3b
* 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>
29 lines
916 B
Text
29 lines
916 B
Text
# Perform a build
|
|
FROM golang:alpine AS build
|
|
EXPOSE 8080 1935
|
|
RUN mkdir /build
|
|
ADD . /build
|
|
WORKDIR /build
|
|
RUN apk update && apk add --no-cache gcc build-base linux-headers
|
|
|
|
ARG VERSION
|
|
ENV VERSION=${VERSION}
|
|
ARG GIT_COMMIT
|
|
ENV GIT_COMMIT=${GIT_COMMIT}
|
|
ARG NAME
|
|
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"]
|