Browse Source
* Consolidate Dockerfile into root and consolidate version into config * Correct the build args herepull/1121/head
6 changed files with 32 additions and 62 deletions
@ -1,18 +1,28 @@ |
|||||||
|
# Perform a build |
||||||
FROM golang:alpine AS build |
FROM golang:alpine AS build |
||||||
RUN apk add --no-cache gcc build-base linux-headers |
EXPOSE 8080 1935 |
||||||
|
RUN mkdir /build |
||||||
|
ADD . /build |
||||||
WORKDIR /build |
WORKDIR /build |
||||||
COPY . /build |
RUN apk update && apk add --no-cache gcc build-base linux-headers |
||||||
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o owncast . |
|
||||||
|
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.BuildVersion=$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 |
FROM alpine |
||||||
RUN apk add --no-cache ffmpeg ffmpeg-libs |
RUN apk update && apk add --no-cache ffmpeg ffmpeg-libs ca-certificates && update-ca-certificates |
||||||
|
|
||||||
|
# Copy owncast assets |
||||||
WORKDIR /app |
WORKDIR /app |
||||||
COPY webroot /app/webroot |
|
||||||
COPY static /app/static |
|
||||||
COPY --from=build /build/owncast /app/owncast |
COPY --from=build /build/owncast /app/owncast |
||||||
|
COPY --from=build /build/webroot /app/webroot |
||||||
EXPOSE 8080 1935 |
COPY --from=build /build/static /app/static |
||||||
|
RUN mkdir /app/data |
||||||
CMD ["/app/owncast"] |
CMD ["/app/owncast"] |
||||||
|
@ -1,28 +0,0 @@ |
|||||||
# 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 |
|
||||||
ENV VERSION=${VERSION} |
|
||||||
ARG GIT_COMMIT |
|
||||||
ENV GIT_COMMIT=${GIT_COMMIT} |
|
||||||
ARG NAME |
|
||||||
ENV NAME=${NAME} |
|
||||||
|
|
||||||
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.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 |
|
||||||
COPY --from=build /build/static /app/static |
|
||||||
RUN mkdir /app/data |
|
||||||
CMD ["/app/owncast"] |
|
Loading…
Reference in new issue