Allow on-the-fly setting of UID/GID for Docker container user.

This commit is contained in:
Buster "Silver Eagle" Neece 2021-06-29 11:21:40 -05:00
parent 2b70f6531b
commit b40316064b
No known key found for this signature in database
GPG Key ID: 6D9E12FF03411F4E
4 changed files with 29 additions and 1 deletions

View File

@ -16,7 +16,17 @@ release channel, you can take advantage of these new features and fixes.
## Code Quality/Technical Changes
-
- The main web Docker container will now automatically initialize itself upon startup, performing essential tasks like
updating the database, clearing the cache and ensuring the system is set up properly. This means even if you miss a
step in installation (or use the Docker images directly) they should still work without issue.
- You can optionally disable Redis entirely, instead relying on flatfile caches for session management and other Redis
functions by setting `ENABLE_REDIS=false` in `azuracast.env`. This is not recommended for most users as Redis offers
great performance, but if you are looking to minimize the number of running containers, this is a viable option.
- One of the biggest issues with Docker file mounting has been permissions; you can now set a custom UID/GID for the
running user inside the Docker containers, to match the one you use in your host operating system.
Set `AZURACAST_PUID` and `AZURACAST_PGID` in `.env` accordingly; both default to 1000.
## Bug Fixes

View File

@ -67,6 +67,8 @@ services :
NGINX_TIMEOUT : ${NGINX_TIMEOUT:-1800}
LETSENCRYPT_HOST : ${LETSENCRYPT_HOST}
LETSENCRYPT_EMAIL : ${LETSENCRYPT_EMAIL}
PUID : ${AZURACAST_PUID:-1000}
PGID : ${AZURACAST_PGID:-1000}
volumes :
- letsencrypt:/etc/nginx/certs:ro
- www_vendor:/var/azuracast/www/vendor
@ -115,6 +117,9 @@ services :
stations :
container_name : azuracast_stations
image : "ghcr.io/azuracast/radio:${AZURACAST_VERSION:-latest}"
environment :
PUID : ${AZURACAST_PUID:-1000}
PGID : ${AZURACAST_PGID:-1000}
ports :
# This default mapping is the outgoing and incoming ports for the first 50 stations.
# You can override this port mapping in your own docker-compose.override.yml file.

View File

@ -5,4 +5,7 @@ AZURACAST_HTTPS_PORT=443
AZURACAST_SFTP_PORT=2022
AZURACAST_PUID=1000
AZURACAST_PGID=1000
NGINX_TIMEOUT=1800

View File

@ -0,0 +1,10 @@
#!/bin/bash
PUID=${PUID:-1000}
PGID=${PGID:-1000}
groupmod -o -g "$PGID" azuracast
usermod -o -u "$PUID" azuracast
echo "Docker 'azuracast' User UID: $(id -u azuracast)"
echo "Docker 'azuracast' User GID: $(id -g azuracast)"