-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
65 lines (42 loc) · 1.22 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
# Stage 1: Build client
FROM node:20 as build-client
WORKDIR /build
COPY package.json package-lock.json ./
COPY tailwind.config.ts tailwind.css ./
RUN npm ci
COPY ./game/client/ ./game/client/
COPY ./web/ ./web/
RUN npm run build-client
RUN find . -type d -name "node_modules" -prune -o -type f -print
# Stage 2: Build server
FROM golang:1.21-alpine as build-server
WORKDIR /build
COPY go.mod go.sum ./
COPY ./gecgos/ ./gecgos/
RUN go mod download
COPY main.go ./
COPY ./game/server/ ./game/server/
COPY ./api/ ./api/
COPY ./utils/ ./utils/
RUN go build .
RUN find .
# Stage 3: Run server
FROM alpine:latest
WORKDIR /app
RUN apk add --no-cache \
unzip \
ca-certificates \
# this is needed only if you want to use scp to copy later your pb_data locally
openssh
# uncomment to copy the local pb_migrations dir into the container
# COPY ./pb_migrations /pb/pb_migrations
# uncomment to copy the local pb_hooks dir into the container
# COPY ./pb_hooks /pb/pb_hooks
COPY --from=build-client ./build/game/client/dist/ ./web/static/
COPY --from=build-server ./build/whirled2 ./
COPY ./web/ ./web/
COPY ./sql/ ./sql/
COPY ./.env ./
RUN find .
# start whirled2
CMD ["/app/whirled2", "serve", "--http=0.0.0.0:42069"]