2020-09-26 09:44:43 +02:00
|
|
|
# Perform a build
|
|
|
|
FROM golang:alpine AS build
|
2020-07-07 09:23:21 +02:00
|
|
|
EXPOSE 8080 1935
|
2020-09-26 09:44:43 +02:00
|
|
|
RUN mkdir /build
|
|
|
|
ADD . /build
|
|
|
|
WORKDIR /build
|
2020-07-15 02:42:06 +02: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 03:39:39 +02: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 02:42:06 +02:00
|
|
|
|
2020-09-26 09:44:43 +02: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 09:23:21 +02:00
|
|
|
WORKDIR /app
|
2020-09-26 09:44:43 +02:00
|
|
|
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
|
|
|
|
|
2020-09-25 20:08:53 +02:00
|
|
|
CMD ["/app/owncast"]
|