Skip to content

Commit

Permalink
docker: respect puid pgid env, no longer expose SAVE_PATH env
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisCris committed Apr 29, 2024
1 parent 9dc5fb8 commit d18fe05
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build_and_run_docker.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 6 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
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 \
&& npm run build \
&& 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"]
3 changes: 1 addition & 2 deletions docker/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 7 additions & 9 deletions docker/sample-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/palworld_pal_editor/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit d18fe05

Please sign in to comment.