diff --git a/build_and_run_docker.sh b/build_and_run_docker.sh index 9fd5daf..37b5cc0 100755 --- a/build_and_run_docker.sh +++ b/build_and_run_docker.sh @@ -1,4 +1,4 @@ -docker build -t palworld-pal-editor -f docker/Dockerfile . +docker build --no-cache -t palworld-pal-editor -f docker/Dockerfile . if which docker-compose > /dev/null; then docker-compose -f docker/docker-compose.yml up -d diff --git a/docker/Dockerfile b/docker/Dockerfile index 9010cc4..8cb2f2d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,17 +1,17 @@ FROM nikolaik/python-nodejs:python3.12-nodejs21-slim ENV PATH=/usr/local/nginx/bin:$PATH -EXPOSE $APP_PORT +EXPOSE 58888 +VOLUME [ "/mnt/gamesave" ] WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ tini \ gosu \ - tzdata \ && apt-get clean && rm -rf /var/lib/apt/lists/* -COPY --chown=pn:pn ./ /app +COPY --chown=pn:pn --chmod=777 ./ /app RUN cd "/app/frontend/palworld-pal-editor-webui" \ && npm install \ @@ -19,8 +19,10 @@ RUN cd "/app/frontend/palworld-pal-editor-webui" \ && mv "/app/frontend/palworld-pal-editor-webui/dist" "/app/src/palworld_pal_editor/webui" RUN pip install --no-cache-dir -r requirements.txt \ - && pip install -e . + pip install -e . RUN chmod +x /app/docker/app.sh +ENTRYPOINT ["tini", "-g", "--"] + CMD ["/app/docker/app.sh"] \ No newline at end of file diff --git a/docker/app.sh b/docker/app.sh index 23cf0d1..bb3099f 100644 --- a/docker/app.sh +++ b/docker/app.sh @@ -5,12 +5,11 @@ if [ ! -z "$PUID" ] && [ ! -z "$PGID" ]; then groupmod -g $PGID pn fi -cmd="python -m palworld_pal_editor --nocli" +cmd="gosu pn:pn python -m palworld_pal_editor --nocli --path=\"/mnt/gamesave\"" 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" diff --git a/docker/sample-docker-compose.yml b/docker/sample-docker-compose.yml index bcf7dcc..4f65291 100644 --- a/docker/sample-docker-compose.yml +++ b/docker/sample-docker-compose.yml @@ -3,16 +3,14 @@ services: image: ghcr.io/kriscris/palworld-pal-editor:latest restart: unless-stopped container_name: palworld-pal-editor - # network_mode: host ports: - - 58888:58888 + - 8080:58888 # Host Port : Container Port environment: - - PUID=1000 # change this to your uid - - PGID=1000 - - APP_PORT=58888 # make sure this matches the port you are going to map - - APP_LANG=en # options: en, zh-CN, ja + - PUID=1000 # Change this to your uid + - PGID=1000 # Change this to your gid + - APP_PORT=58888 # The port Palworld Pal Editor listens on, normally you don't modify it unless network is set to host mode. + - 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. + - PASSWORD=password # To prevent unauthorized access, a strong password is recommended. volumes: - - "/Host/Path/To/The/GameSave/AF518B19A47340B8A55BC58137981393:/mnt/gamesave" # host path : container path + - "/Host/Path/To/The/GameSave/AF518B19A47340B8A55BC58137981393:/mnt/gamesave" # Host path : Container path diff --git a/src/palworld_pal_editor/gui.py b/src/palworld_pal_editor/gui.py index 15d8cc0..7ed06cf 100644 --- a/src/palworld_pal_editor/gui.py +++ b/src/palworld_pal_editor/gui.py @@ -22,6 +22,7 @@ def main(): if response.status_code == 200: LOGGER.info("Backend ready, launching GUI...") break + time.sleep(0.5) except requests.exceptions.ConnectionError: time.sleep(0.5)