-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
57 lines (39 loc) · 1.25 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
FROM golang:1.21 as builderGo
USER root
WORKDIR /csgo-2d-demo-player
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build \
-a -o _output/main \
-gcflags all=-trimpath=/ \
-asmflags all=-trimpath=/ \
main.go
FROM node:lts-slim as builderNpm
USER root
# index build
WORKDIR /csgo-2d-demo-player/index
COPY web/index/package.json .
COPY web/index/package-lock.json .
RUN npm install
COPY web/index/.env.production .
COPY web/index/public public
COPY web/index/src src
RUN npm run build
# player build
WORKDIR /csgo-2d-demo-player/player
COPY web/player/package.json .
COPY web/player/package-lock.json .
RUN npm install
COPY web/player/public public
COPY web/player/src src
RUN npm run build
FROM debian:buster-slim
RUN apt-get update && apt-get install -y ca-certificates
COPY --from=builderGo /csgo-2d-demo-player/_output/main /csgo-2d-demo-player/
COPY --from=builderGo /csgo-2d-demo-player/assets/ /csgo-2d-demo-player/assets/
COPY --from=builderNpm /csgo-2d-demo-player/player/build/ /csgo-2d-demo-player/web/player/build/
COPY --from=builderNpm /csgo-2d-demo-player/index/build/ /csgo-2d-demo-player/web/index/build/
WORKDIR /csgo-2d-demo-player
CMD /csgo-2d-demo-player/main