2020-09-26 00:44:43 -07:00
|
|
|
# Perform a build
|
|
|
|
FROM golang:alpine AS build
|
2020-07-07 00:23:21 -07:00
|
|
|
EXPOSE 8080 1935
|
2020-09-26 00:44:43 -07:00
|
|
|
RUN mkdir /build
|
|
|
|
ADD . /build
|
|
|
|
WORKDIR /build
|
2020-07-14 17:42:06 -07:00
|
|
|
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}
|
|
|
|
|
2021-03-07 21:02:25 -08:00
|
|
|
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.BuildPlatform=$NAME" -o owncast .
|
2020-07-14 17:42:06 -07:00
|
|
|
|
2020-09-26 00:44:43 -07:00
|
|
|
# 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
|
2020-07-07 00:23:21 -07:00
|
|
|
WORKDIR /app
|
2020-09-26 00:44:43 -07:00
|
|
|
COPY --from=build /build/owncast /app/owncast
|
|
|
|
COPY --from=build /build/webroot /app/webroot
|
|
|
|
COPY --from=build /build/static /app/static
|
2020-12-13 23:09:55 -08:00
|
|
|
COPY --from=build /build/data /app/data
|
2021-03-27 18:07:23 -07:00
|
|
|
COPY --from=build /build/webroot/img/logo.svg app/data/logo.svg
|
2020-09-25 11:08:53 -07:00
|
|
|
CMD ["/app/owncast"]
|