summaryrefslogtreecommitdiff
path: root/build/release/Dockerfile-build
blob: 70f56de2af1f8f4e338cb16a2744ab49f28655dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# 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.BuildType=$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/config-default.yaml /app/config.yaml
COPY --from=build /build/webroot /app/webroot
COPY --from=build /build/static /app/static

CMD ["/app/owncast"]