Skip to content

Commit

Permalink
refactor(yukon): remove PUID/GUID
Browse files Browse the repository at this point in the history
Although it works, it caused some problems if the docker image was not regenerated on each use. These values must be updated in runtime.
  • Loading branch information
n0bodysec committed Sep 29, 2022
1 parent c474158 commit bf22a0b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 36 deletions.
21 changes: 0 additions & 21 deletions yukon/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,3 @@ GAME_LOGIN_HOST=localhost
GAME_LOGIN_PORT=6111
GAME_BLIZZARD_HOST=localhost
GAME_BLIZZARD_PORT=6112

##############################################
# Docker
##############################################
#
# PUID
# ----
# The UID of the user who will run the server
# Docker container. This is not needed for
# Windows users.
#
# PGID
# ----
# The GID of the user who will run the server
# Docker container. This is not needed for
# Windows users.
#
##############################################

PUID=1000
PGID=1000
8 changes: 1 addition & 7 deletions yukon/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ services:

server:
image: yukon/server
build:
context: ./server
args:
PUID: ${PUID:-1000}
PGID: ${PGID:-1000}
build: ./server
restart: unless-stopped
# ports: [ '${GAME_LOGIN_PORT}:${GAME_LOGIN_PORT}', '${GAME_BLIZZARD_PORT}:${GAME_BLIZZARD_PORT}' ]
networks: [ 'default', 'db' ]
Expand Down Expand Up @@ -87,8 +83,6 @@ services:
wget -qO res.json https://api.github.com/repos/ruffle-rs/ruffle/releases
node -p "require('./res.json').flatMap(x => x.assets).find(y => y.browser_download_url.includes('selfhosted')).browser_download_url;" | xargs -n1 wget -qO ruffle.zip
unzip -d www/assets/scripts/lib/ruffle ruffle.zip
echo "Chowning all files..."
chown -R $$PUID:$$PGID *
networks:
db:
Expand Down
8 changes: 0 additions & 8 deletions yukon/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@ FROM node:alpine

# args & env
ARG WAIT_FOR_VERSION=4df3f9262d84cab0039c07bf861045fbb3c20ab7
ARG PUID=1000
ARG PGID=1000
ENV DOCKERIZE_VERSION=v0.6.1

# setup non-root user
RUN deluser --remove-home node && addgroup -S node -g ${PGID} && adduser -S -G node -u ${PUID} node

# install dockerize
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz

# run as non-root user
USER node

WORKDIR /srv/server
CMD ["npm", "run", "start"]

0 comments on commit bf22a0b

Please sign in to comment.