Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

Fix PUID and PGID handling (#711)

Julian Nadeau7b60748e3e3f
diff --git a/Dockerfile b/Dockerfile
index a67acbd..314d9a1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,7 +6,7 @@ WORKDIR /var/www/html
# Update packages and install dependencies
RUN apk upgrade --no-cache && \
- apk add --no-cache sqlite-dev libpng libpng-dev libjpeg-turbo libjpeg-turbo-dev freetype freetype-dev curl autoconf libgomp icu-dev icu-data-full nginx dcron tzdata imagemagick imagemagick-dev libzip-dev sqlite libwebp-dev && \
+ apk add --no-cache shadow sqlite-dev libpng libpng-dev libjpeg-turbo libjpeg-turbo-dev freetype freetype-dev curl autoconf libgomp icu-dev icu-data-full nginx dcron tzdata imagemagick imagemagick-dev libzip-dev sqlite libwebp-dev && \
docker-php-ext-install pdo pdo_sqlite calendar && \
docker-php-ext-enable pdo pdo_sqlite && \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && \
diff --git a/README.md b/README.md
index 80d1b86..4a1f29c 100644
--- a/README.md
+++ b/README.md
@@ -114,10 +114,12 @@ See instructions to run Wallos below.
```bash
docker run -d --name wallos -v /path/to/config/wallos/db:/var/www/html/db \
-v /path/to/config/wallos/logos:/var/www/html/images/uploads/logos \
--e TZ=Europe/Berlin -p 8282:80 --restart unless-stopped \
+-e TZ=Europe/Berlin -e PUID=82 -e PGID=82 -p 8282:80 --restart unless-stopped \
bellamy/wallos:latest
```
+Note: PUID and PGUID are optional, defaults to 82. Will let you run as an arbitrary user.
+
### Docker Compose
```
@@ -129,6 +131,9 @@ services:
- "8282:80/tcp"
environment:
TZ: 'America/Toronto'
+ # PUID and PGUID are optional, defaults to 82. Will let you run as an arbitrary user.
+ # PUID: 82
+ # PGID: 82
# Volumes store your data between container upgrades
volumes:
- './db:/var/www/html/db'
diff --git a/startup.sh b/startup.sh
index 7400b17..388c353 100644
--- a/startup.sh
+++ b/startup.sh
@@ -2,12 +2,15 @@
echo "Startup script is running..." > /var/log/startup.log
-# If the PUID or PGID environment variables are set, create a new user and group
-if [ ! -z "$PUID" ] && [ ! -z "$PGID" ]; then
- addgroup -g $PGID appgroup
- adduser -D -u $PUID -G appgroup appuser
- chown -R appuser:appgroup /var/www/html
-fi
+# Default the PUID and PGID environment variables to 82, otherwise
+# set to the user defined ones.
+PUID=${PUID:-82}
+PGID=${PGID:-82}
+
+# Change the www-data user id and group id to be the user-specified ones
+groupmod -o -g "$PGID" www-data
+usermod -o -u "$PUID" www-data
+chown -R www-data:www-data /var/www/html
# Start both PHP-FPM and Nginx
php-fpm & nginx -g 'daemon off;' & touch ~/startup.txt