owncast/Dockerfile
Gabe Kangas ca9d5de192
Embed static resources (#1466)
* Replace pkger with go:embed for bundling the admin. Closes #844

* Remove references to pkged.go

* Point tests to use an updated version of Go

* Add comment to new exported function

* Cleanup

* Add a dummy pkged.go to alert people to stop using it.

* Add simple browser test to make sure the admin is available and renders

* Don't panic

* Embed bot/scraper metadata template.

Add browser test to validate the rendering of this template.

* Use embedded offline.ts segment

* Remove placeholder thumbnail as its unnecessary

* Remove copying the static directory into the release

* Cleanup
2021-10-11 15:04:16 -07:00

28 lines
940 B
Docker

# Perform a build
FROM golang:alpine AS build
EXPOSE 8080 1935
RUN mkdir /build
ADD . /build
WORKDIR /build
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}
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 .
# 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
WORKDIR /app
COPY --from=build /build/owncast /app/owncast
COPY --from=build /build/webroot /app/webroot
RUN mkdir /app/data
CMD ["/app/owncast"]