-
Notifications
You must be signed in to change notification settings - Fork 90
/
Dockerfile
92 lines (60 loc) · 2.36 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
# --------- frontend -----------
FROM node:20.10-alpine as frontendBuilder
WORKDIR /app
ARG proxy
# RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN npm install -g [email protected]
# RUN [ -z "$proxy" ] || pnpm config set registry https://registry.npm.taobao.org
COPY ./web/pnpm-lock.yaml /app/web/pnpm-lock.yaml
COPY ./web/package.json /app/web/package.json
RUN cd /app/web/ && pnpm i
COPY ./web /app/web
RUN cd /app/web/ && pnpm build
COPY ./pal-conf/pnpm-lock.yaml /app/pal-conf/pnpm-lock.yaml
COPY ./pal-conf/package.json /app/pal-conf/package.json
RUN cd /app/pal-conf/ && pnpm i
COPY ./pal-conf /app/pal-conf
RUN cd /app/pal-conf/ && pnpm build
RUN mv /app/pal-conf/dist/assets/* /app/assets
RUN mv /app/pal-conf/dist/index.html /app/pal-conf.html
# --------- sav_cli -----------
FROM python:3.11-alpine as savBuilder
WORKDIR /app
ARG proxy
RUN [ -z "$proxy" ] || sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add build-base
COPY ./module/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
COPY ./module /app
RUN pyinstaller --onefile sav_cli.py
# --------- map tiles -----------
FROM python:3.11-alpine as mapDownloader
WORKDIR /app
RUN apk update && apk add curl unzip
# https://github.com/zaigie/palworld-server-tool/releases/download/v0.0.1/map.zip
RUN curl -L -o map.zip https://github.com/zaigie/palworld-server-tool/releases/download/v0.0.1/map.zip
RUN unzip map.zip -d /app
# --------- backend -----------
FROM golang:1.21-alpine as backendBuilder
ARG proxy
ARG version
WORKDIR /app
ADD . .
COPY --from=frontendBuilder /app/assets /app/assets
COPY --from=frontendBuilder /app/index.html /app/index.html
COPY --from=frontendBuilder /app/pal-conf.html /app/pal-conf.html
COPY --from=mapDownloader /app/map /app/map
RUN if [ ! -z "$proxy" ]; then \
export GOPROXY=https://goproxy.io,direct && \
go build -ldflags="-s -w -X 'main.version=${version}'" -o /app/dist/pst main.go; \
else \
go build -ldflags="-s -w -X 'main.version=${version}'" -o /app/dist/pst main.go; \
fi
# --------- runtime -----------
FROM alpine as runtime
WORKDIR /app
ENV SAVE__DECODE_PATH /app/sav_cli
COPY --from=savBuilder /app/dist/sav_cli /app/sav_cli
COPY --from=backendBuilder /app/dist/pst /app/pst
EXPOSE 8080
CMD ["/app/pst"]