-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
111 lines (92 loc) · 2.2 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#
# Builder
#
FROM golang:1.16-alpine3.13 AS builder
WORKDIR /app
# Install build tool dependencies
RUN apk add protobuf protobuf-dev make gcc musl-dev
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
# Install modules
COPY go.mod go.sum /app/
RUN go mod download all
# Copy source and build all
COPY Makefile .
COPY protos/ protos/
COPY internal/ internal/
COPY cmd/ cmd/
RUN make build
#
# Web App Builder
#
FROM node:17 AS webapp-builder
WORKDIR /usr/src/app
COPY webapp/package.json webapp/package-lock.json ./
RUN npm ci
COPY webapp/ ./
COPY protos/ /usr/src/protos/
RUN npm run build
#
# Base runner
#
FROM alpine:3.13 AS base-runner
# Following commands are for installing CA certs (for proper functioning of HTTPS and other TLS)
RUN apk --update add ca-certificates && \
rm -rf /var/cache/apk/*
RUN adduser -D pizzatribes
RUN mkdir -p /data && chown -R pizzatribes /data
USER pizzatribes
WORKDIR /home/pizzatribes
EXPOSE 8080
#
# Gamelet
#
FROM base-runner AS gamelet
COPY --from=builder /app/out/pizza-tribes-gamelet /app/pizza-tribes-gamelet
CMD ["/app/pizza-tribes-gamelet"]
#
# API
#
FROM base-runner AS api
COPY --from=builder /app/out/pizza-tribes-api /app/pizza-tribes-api
CMD ["/app/pizza-tribes-api"]
#
# Updater
#
FROM base-runner AS updater
COPY --from=builder /app/out/pizza-tribes-updater /app/pizza-tribes-updater
CMD ["/app/pizza-tribes-updater"]
#
# Worker
#
FROM base-runner AS worker
COPY --from=builder /app/out/pizza-tribes-worker /app/pizza-tribes-worker
CMD ["/app/pizza-tribes-worker"]
#
# Migrator
#
FROM base-runner AS migrator
COPY --from=builder /app/out/pizza-tribes-migrator /app/pizza-tribes-migrator
CMD ["/app/pizza-tribes-migrator"]
#
# Admin
#
FROM base-runner AS admin
COPY --from=builder /app/out/pizza-tribes-admin /app/pizza-tribes-admin
CMD ["/app/pizza-tribes-admin"]
#
# Central
#
FROM base-runner AS central
COPY --from=builder /app/out/pizza-tribes-central /app/pizza-tribes-central
CMD ["/app/pizza-tribes-central"]
#
# Web App
#
FROM nginx AS webapp
COPY ./PRIVACY_POLICY.html /usr/share/nginx/html/privacy-policy.html
COPY --from=webapp-builder /usr/src/app/dist/ /usr/share/nginx/html
#
# Front
#
FROM caddy:2 AS front
COPY Caddyfile /etc/caddy/Caddyfile