2021-06-18 05:27:17 +03:00
|
|
|
# Perform a build
|
2021-05-22 04:18:42 +03:00
|
|
|
FROM golang:alpine AS build
|
2021-06-18 05:27:17 +03:00
|
|
|
EXPOSE 8080 1935
|
|
|
|
RUN mkdir /build
|
|
|
|
ADD . /build
|
2021-05-22 04:18:42 +03:00
|
|
|
WORKDIR /build
|
2021-06-18 05:27:17 +03:00
|
|
|
RUN apk update && apk add --no-cache gcc build-base linux-headers
|
|
|
|
|
|
|
|
ARG VERSION=dev
|
|
|
|
ENV VERSION=${VERSION}
|
|
|
|
ARG GIT_COMMIT
|
|
|
|
ENV GIT_COMMIT=${GIT_COMMIT}
|
|
|
|
ARG NAME=docker
|
|
|
|
ENV NAME=${NAME}
|
2021-05-22 04:18:42 +03:00
|
|
|
|
2021-06-18 05:27:17 +03:00
|
|
|
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags "-extldflags \"-static\" -s -w -X github.com/owncast/owncast/config.GitCommit=$GIT_COMMIT -X github.com/owncast/owncast/config.BuildVersion=$VERSION -X github.com/owncast/owncast/config.BuildPlatform=$NAME" -o owncast .
|
2021-05-22 04:18:42 +03:00
|
|
|
|
2021-06-18 05:27:17 +03:00
|
|
|
# Create the image by copying the result of the build into a new alpine image
|
2021-05-22 04:18:42 +03:00
|
|
|
FROM alpine
|
2021-06-18 05:27:17 +03:00
|
|
|
RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates && update-ca-certificates
|
2021-05-22 04:18:42 +03:00
|
|
|
|
2021-06-18 05:27:17 +03:00
|
|
|
# Copy owncast assets
|
2020-06-10 04:28:07 +03:00
|
|
|
WORKDIR /app
|
2021-05-22 04:18:42 +03:00
|
|
|
COPY --from=build /build/owncast /app/owncast
|
2021-06-18 05:27:17 +03:00
|
|
|
COPY --from=build /build/webroot /app/webroot
|
|
|
|
COPY --from=build /build/static /app/static
|
|
|
|
RUN mkdir /app/data
|
2020-12-11 08:57:18 +03:00
|
|
|
CMD ["/app/owncast"]
|