Dockerfile 944 B

123456789101112131415161718192021222324252627
  1. # Perform a build
  2. FROM golang:alpine AS build
  3. RUN mkdir /build
  4. ADD . /build
  5. WORKDIR /build
  6. RUN apk update && apk add --no-cache git gcc build-base linux-headers
  7. ARG VERSION=dev
  8. ENV VERSION=${VERSION}
  9. ARG GIT_COMMIT
  10. ENV GIT_COMMIT=${GIT_COMMIT}
  11. ARG NAME=docker
  12. ENV NAME=${NAME}
  13. 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.VersionNumber=$VERSION -X github.com/owncast/owncast/config.BuildPlatform=$NAME" -o owncast .
  14. # Create the image by copying the result of the build into a new alpine image
  15. FROM alpine
  16. RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates && update-ca-certificates
  17. # Copy owncast assets
  18. WORKDIR /app
  19. COPY --from=build /build/owncast /app/owncast
  20. COPY --from=build /build/webroot /app/webroot
  21. RUN mkdir /app/data
  22. CMD ["/app/owncast"]
  23. EXPOSE 8080 1935