Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求出个docker版本的! #38

Open
NikoYomi opened this issue Jan 29, 2024 · 5 comments
Open

求出个docker版本的! #38

NikoYomi opened this issue Jan 29, 2024 · 5 comments

Comments

@NikoYomi
Copy link

求出个docker版本的!

@dezhishen
Copy link

dezhishen commented Jan 29, 2024

按照以下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
Copy link

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
Copy link
Author

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
Copy link

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
Copy link
Contributor

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 參數,導致根本無法登入...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants