mirror of
https://github.com/FuzzyGrim/Yamtrack.git
synced 2026-03-03 02:27:01 +00:00
fix: user management in Docker container startup
This commit is contained in:
@@ -10,14 +10,14 @@ COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
WORKDIR /yamtrack
|
||||
|
||||
RUN apk add --no-cache nginx \
|
||||
RUN apk add --no-cache nginx shadow \
|
||||
&& pip install --no-cache-dir -r /requirements.txt \
|
||||
&& pip install --no-cache-dir supervisor==4.2.5 \
|
||||
&& rm -rf /root/.cache /tmp/* \
|
||||
&& find /usr/local -type d -name __pycache__ -exec rm -rf {} + \
|
||||
&& chmod +x /entrypoint.sh \
|
||||
# create user abc for later PUID/PGID mapping
|
||||
&& adduser -D -H -s /bin/sh abc \
|
||||
&& useradd -U -M -s /bin/sh abc \
|
||||
# Create required nginx directories and set permissions
|
||||
&& mkdir -p /var/log/nginx \
|
||||
&& mkdir -p /var/lib/nginx/body \
|
||||
|
||||
@@ -7,12 +7,8 @@ python manage.py migrate --noinput
|
||||
PUID=${PUID:-1000}
|
||||
PGID=${PGID:-1000}
|
||||
|
||||
if [ "$(id -u abc)" != "$PUID" ] || [ "$(id -g abc)" != "$PGID" ]; then
|
||||
# Delete and recreate the user with the correct IDs
|
||||
deluser abc
|
||||
addgroup -g "$PGID" abc
|
||||
adduser -D -H -G abc -s /bin/sh -u "$PUID" abc
|
||||
fi
|
||||
groupmod -o -g "$PGID" abc
|
||||
usermod -o -u "$PUID" abc
|
||||
|
||||
chown -R abc:abc /yamtrack
|
||||
chown -R abc:abc db
|
||||
|
||||
Reference in New Issue
Block a user