-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (30 loc) · 980 Bytes
/
Dockerfile
File metadata and controls
46 lines (30 loc) · 980 Bytes
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
FROM golang:alpine AS build_base
# WE NEED GIT
RUN apk update && apk add --no-cache git openssl
RUN mkdir -p /etc/certificates
RUN openssl genrsa -out /etc/certificates/fly.rsa 2048
RUN openssl rsa -in /etc/certificates/fly.rsa -pubout > /etc/certificates/fly.rsa.pub
COPY src/ /src
RUN ls src
WORKDIR /src
RUN go install github.com/mitranim/gow@latest
RUN go build -o /api-gateway
CMD ["gow", "run", "."]
#USER appuser
FROM alpine:3.9
RUN mkdir /app
RUN mkdir /etc/certificates
RUN apk add openssl
# GENERATE CERTS
COPY --from=build_base api-gateway /app/api-gateway
COPY --from=build_base /src/model.conf /model.conf
RUN ls /etc
COPY --from=build_base /etc/certificates /etc
# CHANGE RIGHTS ON CERTS
RUN adduser -S -D appuser
RUN chown appuser /etc/certificates/fly.rsa && chown appuser /etc/certificates/fly.rsa.pub && chown appuser /app/api-gateway
RUN chmod +x /app/api-gateway
# USE THE APPLICATION-USER
USER appuser
CMD ["/app/api-gateway"]
EXPOSE 61225