-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
44 lines (32 loc) · 1.5 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM golang:1.20 as build
ARG VERSION="dev"
WORKDIR /ERI
COPY . .
RUN go mod download
RUN go test -v -race ./...
RUN GOFLAGS="-buildvcs=false -trimpath" CGO_ENABLED=0 GO111MODULE=on go build -v -ldflags "-w -X main.Version=${VERSION}" -a ./cmd/web
RUN GOFLAGS="-buildvcs=false -trimpath" CGO_ENABLED=0 GO111MODULE=on go build -v -ldflags "-w -X main.Version=${VERSION}" ./cmd/eri-cli
# @see https://github.com/GoogleContainerTools/distroless
# This 🥑 base image provides Time Zone data and CA-certificates
FROM gcr.io/distroless/static:latest as tzandca
FROM scratch
ARG VERSION="dev"
ARG GIT_REF="none"
LABEL org.label-schema.description="The Email Recipient Inspector Docker image." \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://github.com/Dynom/ERI" \
org.label-schema.vcs-url="https://github.com/Dynom/ERI" \
org.label-schema.vcs-ref="${GIT_REF}" \
org.label-schema.version="${VERSION}"
COPY --from=tzandca ["/etc/ssl/certs/ca-certificates.crt", "/etc/ssl/certs/ca-certificates.crt"]
COPY --from=tzandca ["/usr/share/zoneinfo", "/usr/share/zoneinfo"]
COPY --from=build ["/ERI/web", "/eri"]
COPY --from=build ["/ERI/eri-cli", "/eri-cli"]
COPY --from=build ["/ERI/cmd/web/config.toml", "/"]
# Takes precedence over the configuration.
ENV LISTEN_URL="0.0.0.0:1338"
EXPOSE 1338
# By default k8s kills with TERM, we can't reliably capture that in a cross-platform service. Changing it to
# Interrupt, which we can safely capture.
STOPSIGNAL SIGINT
ENTRYPOINT ["/eri"]