forked from scribble-rs/scribble.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux.Dockerfile
31 lines (26 loc) · 1016 Bytes
/
linux.Dockerfile
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
30
31
#
# Builder for Golang
#
# We explicitly use a certain major version of go, to make sure we don't build
# with a newer verison than we are using for CI tests, as we don't directly
# test the produced binary but from source code directly.
FROM docker.io/golang:1.21.3 AS builder
WORKDIR /app
# This causes caching of the downloaded go modules and makes repeated local
# builds much faster. We must not copy the code first though, as a change in
# the code causes a redownload.
COPY go.mod go.sum ./
RUN go mod download -x
# Copy actual codebase, since we only have the go.mod and go.sum so far.
COPY . /app/
ENV CGO_ENABLED=0
RUN go build -ldflags "-w -s" -tags timetzdata -o ./scribblers ./cmd/scribblers
#
# Runner
#
FROM scratch
COPY --from=builder /app/scribblers /scribblers
# The scratch image doesn't contain any certificates, therefore we use
# the builders certificate, so that we can send HTTP requests.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/scribblers"]