Skip to content

Commit

Permalink
Merge branch 'develop' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisCris committed Apr 28, 2024
2 parents 96ebfeb + a04a6e0 commit edebdd0
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 89 deletions.
10 changes: 2 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@ A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
**System (please complete the following information):**
- OS: [e.g. Windows]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 7 additions & 0 deletions README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- [方案 A. 使用打包的可执行文件](#方案-a-使用打包的可执行文件)
- [方案 B. 通过 pip 安装](#方案-b-通过-pip-安装)
- [方案 C. 使用 Docker Container](#方案-c-使用-docker-container)
- [如果你想手动构建 Image](#如果你想手动构建-image)
- [方案 D. 直接运行代码](#方案-d-直接运行代码)
- [可选命令行参数](#可选命令行参数)
- [配置文件](#配置文件)
Expand Down Expand Up @@ -115,6 +116,12 @@

### 方案 C. 使用 Docker Container

1. 下载 `./docker/sample-docker-compose.yml`
2. 做适当的修改,并重命名为`docker-compse.yml`
3. 运行 `docker compose up -d`

#### 如果你想手动构建 Image

1. 克隆项目.
2. 复制 `./docker/sample-docker-compose.yml``./docker/docker-compose.yml`, 并根据需求做适当修改(网络不佳的用户建议传入代理环境变量)。
3. 运行 `./build_and_run_docker.sh` 以构建容器并运行容器。(Windows的话你把里面的命令复制出来手动跑就行了)。
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
- [Option A. Use Pre-Built Binary](#option-a-use-pre-built-binary)
- [Option B. Install via pip](#option-b-install-via-pip)
- [Option C. Docker Container](#option-c-docker-container)
- [If you want to manually build it](#if-you-want-to-manually-build-it)
- [Option D. Directly Run the Code](#option-d-directly-run-the-code)
- [Optional Command-line Args](#optional-command-line-args)
- [Config File](#config-file)
Expand Down Expand Up @@ -132,6 +133,12 @@

### Option C. Docker Container

1. Download the compose file: `./docker/sample-docker-compose.yml`.
2. Rename it to `docker-compose.yml`, then configure it properly.
3. Run `docker compose up -d`.

#### If you want to manually build it

1. Clone the code.
2. Copy `./docker/sample-docker-compose.yml` to `./docker/docker-compose.yml`, then do necessary modifications.
3. Run `./build_and_run_docker.sh`, or just manually run the commands if you are using Windows.
Expand Down
4 changes: 4 additions & 0 deletions docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.git
.github
.vscode
save_data_re
tests
venv/
logs/
gamesave*/
Expand Down
50 changes: 12 additions & 38 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,52 +1,26 @@
# Use an official Python runtime as a parent image
# FROM python:3.11-slim
FROM nikolaik/python-nodejs:python3.12-nodejs21-slim

# Define environment variables for customization
# ENV TZ=UTC \
# PUID=1000 \
# PGID=1000 \
# APP_PORT=8000 \
# APP_LANG=en \
# LANG=C.UTF-8 \
# PYTHONUNBUFFERED=1 \
# MODE=--cli \
# SAVE_PATH="/mnt/gamesave" \
# PASSWORD=null

# Set the working directory in the container
ENV PATH=/usr/local/nginx/bin:$PATH
EXPOSE $APP_PORT

WORKDIR /app

# Install dependencies required for managing permissions and timezone
RUN apt-get update && apt-get install -y --no-install-recommends \
tini \
gosu \
tzdata \
# && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
# && apt-get install -y nodejs \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# https://github.com/nikolaik/docker-python-nodejs
# All images have a default user `pn`` with uid 1000 and gid 1000.
# Create the appuser user and group before setting permissions
# RUN groupadd -g 1000 appuser && \
# useradd -m -u 1000 -g appuser -s /bin/bash appuser

# Copy the application's requirements.txt and setup script, then install Python dependencies
# COPY ./requirements.txt ./
# RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=pn:pn ./ /app

# Copy the rest of the application's source code
COPY ./ /app
RUN cd "/app/frontend/palworld-pal-editor-webui" \
&& npm install \
&& npm run build \
&& mv "/app/frontend/palworld-pal-editor-webui/dist" "/app/src/palworld_pal_editor/webui"

# Copy the entrypoint script into the image and make it executable
COPY ./docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
RUN chmod +x /app/setup_and_run.sh
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install -e .

ENTRYPOINT ["/entrypoint.sh"]

# Expose the port dynamically
EXPOSE $APP_PORT
RUN chmod +x /app/docker/app.sh

CMD ["./setup_and_run.sh"]
CMD ["/app/docker/app.sh"]
18 changes: 18 additions & 0 deletions docker/app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

if [ ! -z "$PUID" ] && [ ! -z "$PGID" ]; then
usermod -u $PUID pn
groupmod -g $PGID pn
fi

cmd="python -m palworld_pal_editor --nocli"

if [ -n "$APP_LANG" ]; then cmd="$cmd --lang=\"$APP_LANG\""; fi
if [ -n "$APP_PORT" ]; then cmd="$cmd --port=$APP_PORT"; fi
if [ -n "$MODE" ]; then cmd="$cmd --mode=\"$MODE\""; fi
if [ -n "$SAVE_PATH" ]; then cmd="$cmd --path=\"$SAVE_PATH\""; fi
if [ -n "$PASSWORD" ]; then cmd="$cmd --password=\"$PASSWORD\""; fi

echo "Launching: $cmd"

eval "$cmd"
32 changes: 0 additions & 32 deletions docker/entrypoint.sh

This file was deleted.

21 changes: 10 additions & 11 deletions docker/sample-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
version: '3.8'
services:
palworld-pal-editor:
image: docker.io/library/palworld-pal-editor
image: ghcr.io/kriscris/palworld-pal-editor:latest
restart: unless-stopped
container_name: palworld-pal-editor
# network_mode: host
ports:
- 12345:12345
- 58888:58888
environment:
- TZ=UTC
- PUID=1000
- PUID=1000 # change this to your uid
- PGID=1000
- APP_PORT=12345 # make sure this matches the port you are going to map
- APP_LANG=zh-CN
- MODE=web # [cli, web, gui] You are not going to run gui in docker though... ;)
- SAVE_PATH=/mnt/gamesave
- PASSWORD=password # remove this env unless you want a password, but password is strongly recommended (for web mode).
- APP_PORT=58888 # make sure this matches the port you are going to map
- APP_LANG=en # options: en, zh-CN, ja
- MODE=web
- SAVE_PATH=/mnt/gamesave # this should match the volume you mapped to
- PASSWORD=password # to prevent unauthorized access, setting up a strong password is recommended.
volumes:
- "/Users/connlost/Coding/Palworld-Pal-Editor/tests/gamesave/AF518B19A47340B8A55BC58137981393:/mnt/gamesave"
- "/Host/Path/To/The/GameSave/AF518B19A47340B8A55BC58137981393:/mnt/gamesave" # host path : container path

0 comments on commit edebdd0

Please sign in to comment.