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