求出个docker版本的!
NikoYomi opened this issue · 5 comments
NikoYomi commented
求出个docker版本的!
dezhishen commented
按照以下Dockerfile
尝试了下
FROM node:20.9.0 as front-builder
WORKDIR /build
RUN npm install -g @quasar/cli
COPY . .
RUN cd front/palworld-front && npm install && quasar build
FROM golang:1.21.1-alpine as builder
WORKDIR /build
RUN apk add --no-cache upx
COPY . .
COPY --from=front-builder /build/webui/dist /build/webui/dist
RUN cd /build && \
go build -ldflags="-s -w" -o /palworld-go-webui main.go && \
upx /palworld-go-webui
FROM alpine
LABEL maintainer="github.com/dezhishen/palworld-go-webui"
EXPOSE 52000/tcp
WORKDIR /data
VOLUME /data
COPY --from=builder /palworld-go-webui /palworld-go-webui
RUN chmod +x /palworld-go-webui
ENTRYPOINT [ "/palworld-go-webui" ]
出现错误:
...
11.20 # command-line-arguments
11.20 ./main.go:51:16: undefined: NewSupervisor
11.20 ./main.go:55:16: undefined: NewBackupTask
11.20 ./main.go:168:23: undefined: NewpalworldBroadcast
11.20 ./main.go:172:21: undefined: NewMemoryCheckTask
...
@Hoshinonyaruko 麻烦作者看下是不是哪个步骤不对
dezhishen commented
dezhishen
解决了:
FROM node:20.9.0 as front-builder
WORKDIR /build
RUN npm install -g @quasar/cli
COPY . .
RUN cd front/palworld-front && npm install && quasar build
FROM golang:1.21.1-alpine as builder
WORKDIR /build
RUN apk add --no-cache upx
COPY . .
COPY --from=front-builder /build/webui/dist /build/webui/dist
RUN cd /build && \
go build -ldflags="-s -w" -o /palworld-go-webui && \
upx /palworld-go-webui
FROM alpine
LABEL maintainer="github.com/dezhishen/palworld-go-webui"
EXPOSE 52000/tcp
WORKDIR /data
VOLUME /data
COPY --from=builder /palworld-go-webui /palworld-go-webui
RUN chmod +x /palworld-go-webui
ENTRYPOINT [ "/palworld-go-webui" ]
NikoYomi commented
dezhishen 德智深
解决了:
FROM node:20.9.0 as front-builder WORKDIR /build RUN npm install -g @quasar/cli COPY . . RUN cd front/palworld-front && npm install && quasar build FROM golang:1.21.1-alpine as builder WORKDIR /build RUN apk add --no-cache upx COPY . . COPY --from=front-builder /build/webui/dist /build/webui/dist RUN cd /build && \ go build -ldflags="-s -w" -o /palworld-go-webui && \ upx /palworld-go-webui FROM alpine LABEL maintainer="github.com/dezhishen/palworld-go-webui" EXPOSE 52000/tcp WORKDIR /data VOLUME /data COPY --from=builder /palworld-go-webui /palworld-go-webui RUN chmod +x /palworld-go-webui ENTRYPOINT [ "/palworld-go-webui" ]
不会用dockerfile😭
docker compose有吗?
感谢🙏
lonffreytu commented
dezhishen 德智深
解决了:
FROM node:20.9.0 as front-builder WORKDIR /build RUN npm install -g @quasar/cli COPY . . RUN cd front/palworld-front && npm install && quasar build FROM golang:1.21.1-alpine as builder WORKDIR /build RUN apk add --no-cache upx COPY . . COPY --from=front-builder /build/webui/dist /build/webui/dist RUN cd /build && \ go build -ldflags="-s -w" -o /palworld-go-webui && \ upx /palworld-go-webui FROM alpine LABEL maintainer="github.com/dezhishen/palworld-go-webui" EXPOSE 52000/tcp WORKDIR /data VOLUME /data COPY --from=builder /palworld-go-webui /palworld-go-webui RUN chmod +x /palworld-go-webui ENTRYPOINT [ "/palworld-go-webui" ]
不会用dockerfile😭 docker compose有吗? 感谢🙏
version: '3.8'
services:
front-builder:
image: node:20.9.0
working_dir: /build
volumes:
- .:/build
environment:
- NODE_ENV=production
command: |
npm install -g @quasar/cli &&
cd front/palworld-front &&
npm install &&
quasar build
builder:
image: golang:1.21.1-alpine
working_dir: /build
volumes:
- .:/build
depends_on:
- front-builder
environment:
- CGO_ENABLED=0
command: |
apk add --no-cache upx &&
cp -r webui/dist webui/dist &&
go build -ldflags="-s -w" -o /palworld-go-webui &&
upx /palworld-go-webui
palworld-go-webui:
image: alpine
labels:
maintainer: "github.com/dezhishen/palworld-go-webui"
ports:
- "52000:52000"
working_dir: /data
volumes:
- /data
depends_on:
- builder
command: |
cp -r /build/palworld-go-webui /palworld-go-webui &&
chmod +x /palworld-go-webui &&
/palworld-go-webui
以上配置转换来自AICG
Minidoracat commented
dezhishen 德智深
解决了:
FROM node:20.9.0 as front-builder WORKDIR /build RUN npm install -g @quasar/cli COPY . . RUN cd front/palworld-front && npm install && quasar build FROM golang:1.21.1-alpine as builder WORKDIR /build RUN apk add --no-cache upx COPY . . COPY --from=front-builder /build/webui/dist /build/webui/dist RUN cd /build && \ go build -ldflags="-s -w" -o /palworld-go-webui && \ upx /palworld-go-webui FROM alpine LABEL maintainer="github.com/dezhishen/palworld-go-webui" EXPOSE 52000/tcp WORKDIR /data VOLUME /data COPY --from=builder /palworld-go-webui /palworld-go-webui RUN chmod +x /palworld-go-webui ENTRYPOINT [ "/palworld-go-webui" ]
不会用dockerfile😭 docker compose有吗? 感谢🙏
version: '3.8' services: front-builder: image: node:20.9.0 working_dir: /build volumes: - .:/build environment: - NODE_ENV=production command: | npm install -g @quasar/cli && cd front/palworld-front && npm install && quasar build builder: image: golang:1.21.1-alpine working_dir: /build volumes: - .:/build depends_on: - front-builder environment: - CGO_ENABLED=0 command: | apk add --no-cache upx && cp -r webui/dist webui/dist && go build -ldflags="-s -w" -o /palworld-go-webui && upx /palworld-go-webui palworld-go-webui: image: alpine labels: maintainer: "github.com/dezhishen/palworld-go-webui" ports: - "52000:52000" working_dir: /data volumes: - /data depends_on: - builder command: | cp -r /build/palworld-go-webui /palworld-go-webui && chmod +x /palworld-go-webui && /palworld-go-webui以上配置转换来自AICG
都無法使用,而且這都不包含遊戲檔案
我自己包的不知道為何,有產生config.json,卻都不讀取修改後的 config.json 參數,導致根本無法登入...