-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
50 lines (39 loc) · 1.23 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
45
46
47
48
49
FROM golang:1.17-alpine as builder
RUN apk add build-base git
from alpine AS image-base
RUN apk --no-cache add dumb-init curl vim git
# Build api service
FROM builder as service-builder
WORKDIR /service
COPY src/api/. .
RUN go mod download
RUN go build
FROM image-base AS api-service
RUN mkdir -p /opt/service
COPY --from=service-builder /service/api /opt/service/api
WORKDIR /opt/service/
ENTRYPOINT ["/usr/bin/dumb-init", "/opt/service/api"]
CMD []
# Build client service
FROM builder as client-builder
WORKDIR /client
COPY src/client/. .
RUN go mod download
RUN go build
FROM image-base AS client-service
RUN mkdir -p /opt/service
COPY --from=client-builder /client/client /opt/service/client
ENTRYPOINT ["/usr/bin/dumb-init", "/opt/service/client"]
CMD []
WORKDIR /opt/service/
# Build spiffe-helper
FROM builder as helper-builder
WORKDIR /service
RUN git clone -b upgrade-helper https://github.com/marcosdy/spiffe-helper.git .
RUN go build -o /service/spiffe-helper ./cmd/spiffe-helper
FROM image-base AS spiffe-helper
RUN addgroup -g 70 ssl-cert
RUN adduser -G ssl-cert -u 70 -D postgres
RUN apk add --no-cache --upgrade postgresql-client bash
COPY --from=helper-builder /service/spiffe-helper /opt/helper/spiffe-helper
WORKDIR /opt/helper/