Dockerfile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # IMPORTANT: This Dockerfile has been provided for the sake of convenience.
  2. # Currently, functionality of the containers built based on this file
  3. # is not a part of our continuous testing. Although, patches to keep it
  4. # up to date are always welcome.
  5. #
  6. # See ‘Earthfile’ for the recipes used in official builds.
  7. FROM golang:alpine AS build
  8. RUN apk update && apk add --no-cache git gcc build-base linux-headers
  9. WORKDIR /build
  10. COPY . /build
  11. ARG VERSION=dev
  12. ENV VERSION=${VERSION}
  13. ARG GIT_COMMIT
  14. ENV GIT_COMMIT=${GIT_COMMIT}
  15. ARG NAME=docker
  16. ENV NAME=${NAME}
  17. 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 .
  18. # Create the image by copying the result of the build into a new alpine image
  19. FROM alpine:3.19.0
  20. RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates && update-ca-certificates
  21. RUN addgroup -g 101 -S owncast && adduser -u 101 -S owncast -G owncast
  22. # Copy owncast assets
  23. WORKDIR /app
  24. COPY --from=build /build/owncast /app/owncast
  25. RUN mkdir /app/data
  26. RUN chown -R owncast:owncast /app
  27. USER owncast
  28. ENTRYPOINT ["/app/owncast"]
  29. EXPOSE 8080 1935