-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.api
45 lines (33 loc) · 1.54 KB
/
Dockerfile.api
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
45
FROM golang:1.22-alpine AS builder
RUN apk update && apk add --no-cache git gcc
RUN apk add --no-cache sqlite-libs sqlite-dev
RUN apk add --no-cache build-base
RUN update-ca-certificates
RUN mkdir /code/
WORKDIR /code
ARG PLATFORM=arm64
COPY ./api ./api
COPY ./shared ./shared
WORKDIR /code/api
ARG RELEASE_VERSION
ARG GITHUB_SHA
RUN --mount=type=cache,mode=0755,target=/go/pkg/mod GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${PLATFORM} go build -o /code/api/dist/happy-api -ldflags "-w -s -X github.com/chanzuckerberg/happy/shared/util.ReleaseGitSha=${GITHUB_SHA} -X github.com/chanzuckerberg/happy/shared/util.ReleaseVersion=${RELEASE_VERSION}"
# --------------------------------------------------------------------------------------------------
FROM golang:1.22-alpine
COPY --from=builder /code/api/dist/happy-api .
COPY --from=builder /code/api/app-config*.yaml .
ENV CONFIG_YAML_DIRECTORY=./
ENV TZ=utc
# tools for debugging
RUN apk update
RUN apk add postgresql
RUN mkdir -p /tools
COPY ./api/tools/db-shell.sh /tools/db-shell.sh
RUN go install github.com/cespare/[email protected]
COPY ./entrypoint.sh .
RUN apk add openssl
RUN openssl crl2pkcs7 -nocrl -certfile /etc/ssl/certs/ca-certificates.crt | openssl pkcs7 -print_certs -noout | grep RSA2048 || true
ADD https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem /usr/local/share/ca-certificates/global-bundle.crt
RUN update-ca-certificates
RUN openssl crl2pkcs7 -nocrl -certfile /etc/ssl/certs/ca-certificates.crt | openssl pkcs7 -print_certs -noout | grep RSA2048
ENTRYPOINT ["./entrypoint.sh"]