Dockerfile (view raw)
1# syntax=docker/dockerfile:1
2
3FROM golang:1.23-alpine AS builder
4
5RUN apk add --no-cache build-base
6
7WORKDIR /build
8
9# Download Go modules
10COPY go.mod go.sum ./
11RUN go mod download
12
13# Transfer source code
14COPY templates ./templates
15COPY invidious ./invidious
16COPY *.go ./
17
18# Build
19RUN CGO_ENABLED=0 go build -trimpath -o /dist/app
20
21# Test
22FROM build-stage AS run-test-stage
23RUN go test -v ./...
24
25FROM scratch AS build-release-stage
26
27COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
28COPY --from=builder /dist /
29
30ENTRYPOINT ["/app"]