-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
63 lines (43 loc) · 1.18 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
ARG service=webauthn-api
ARG website=webauthn-website
ARG user=samouss
ARG artifact_service=${bin_dir}/build-${service}-amd64.bin
ARG artifact_website=/usr/local/${website}
# --------------------
FROM golang:1.13.6-stretch AS gobuilder
ARG service
ARG website
ARG user
ARG artifact_service
ARG artifact_website
COPY go.mod go.sum webauthn-api /go/src/github.com/${user}/${website}/
WORKDIR /go/src/github.com/${user}/${website}
RUN GO111MODULE=on \
GOOS=linux \
GOARCH=amd64 \
CGO_ENABLED=0 \
go build -trimpath -o ${artifact_service} .
# --------------------
FROM node:8.16.0-stretch AS nodebuilder
ARG service
ARG website
ARG user
ARG artifact_service
ARG artifact_website
COPY webauthn-website ${artifact_website}/
WORKDIR ${artifact_website}
RUN yarn && yarn build
# --------------------
FROM alpine:3.10.3
ARG service
ARG website
ARG user
ARG artifact_service
ARG artifact_website
RUN addgroup -S ${user} && adduser -S ${user} -G ${user}
COPY --from=gobuilder ${artifact_service} /usr/local/bin/${service}
COPY --from=nodebuilder ${artifact_website}/build /home/${user}/${website}
USER ${user}
WORKDIR /home/${user}
ENV SERVICE_NAME ${service}
CMD ${SERVICE_NAME}