-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (37 loc) · 1.24 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.20-alpine3.18 as base
RUN apk add gcc g++
ADD go.mod /Helldivers2Tools/go.mod
ADD go.sum /Helldivers2Tools/go.sum
WORKDIR /Helldivers2Tools
RUN go mod download
ADD pkg/shared /Helldivers2Tools/pkg/shared
ADD cmd/cli /Helldivers2Tools/cmd/cli
# Building cli here since it is shared
# This also caches shared dependencies
RUN CGO_ENABLED=1 GOOS=linux go build -v -o /cli ./cmd/cli
# --- BUILD STAGE ---
FROM base as api_builder
ADD pkg/api /Helldivers2Tools/pkg/api
ADD cmd/api /Helldivers2Tools/cmd/api
RUN CGO_ENABLED=1 GOOS=linux go build -v -o /api ./cmd/api
FROM base as bot_builder
ADD pkg/bot /Helldivers2Tools/pkg/bot
ADD cmd/bot /Helldivers2Tools/cmd/bot
RUN CGO_ENABLED=1 GOOS=linux go build -v -o /bot ./cmd/bot
FROM base as updater_builder
ADD cmd/updater /Helldivers2Tools/cmd/updater
RUN CGO_ENABLED=1 GOOS=linux go build -v -o /updater ./cmd/updater
# --- FINAL STAGE ---
FROM alpine as api
COPY --from=api_builder /cli /cli
COPY --from=api_builder /api /api
ADD data /data
ENTRYPOINT ["/api"]
FROM alpine as bot
COPY --from=bot_builder /cli /cli
COPY --from=bot_builder /bot /bot
ENTRYPOINT ["/bot"]
FROM alpine as updater
COPY --from=updater_builder /cli /cli
COPY --from=updater_builder /updater /updater
ENTRYPOINT ["/updater"]