2020-09-26 10:44:43 +03:00
|
|
|
# Perform a build
|
|
|
|
FROM golang:alpine AS build
|
2020-07-07 10:23:21 +03:00
|
|
|
EXPOSE 8080 1935
|
2020-09-26 10:44:43 +03:00
|
|
|
RUN mkdir /build
|
|
|
|
ADD . /build
|
|
|
|
WORKDIR /build
|
2020-07-15 03:42:06 +03: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}
|
|
|
|
|
2020-07-21 04:39:39 +03: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.BuildType=$NAME" -o owncast .
|
2020-07-15 03:42:06 +03:00
|
|
|
|
2020-09-26 10:44:43 +03: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 10:23:21 +03:00
|
|
|
WORKDIR /app
|
2020-09-26 10:44:43 +03:00
|
|
|
COPY --from=build /build/owncast /app/owncast
|
2020-09-28 02:36:52 +03:00
|
|
|
COPY --from=build /build/config-example.yaml /app/config.yaml
|
2020-09-26 10:44:43 +03:00
|
|
|
COPY --from=build /build/webroot /app/webroot
|
|
|
|
COPY --from=build /build/static /app/static
|
|
|
|
|
2020-09-25 21:08:53 +03:00
|
|
|
CMD ["/app/owncast"]
|