Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonroot container #94

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ RUN set -eux; \
groupadd --system taiga --gid=999; \
useradd --system --no-create-home --gid taiga --uid=999 --shell=/bin/bash taiga; \
mkdir -p /taiga-back/media/exports; \
chown -R taiga:taiga /taiga-back; \
chown -R taiga:0 /taiga-back; \
chmod -R g+rwX /taiga-back; \
# remove unneeded files and packages
apt-get purge -y \
build-essential \
Expand Down
23 changes: 14 additions & 9 deletions docker/async_entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@

set -euo pipefail

# Give permission to taiga:taiga after mounting volumes
echo Give permission to taiga:taiga
chown -R taiga:taiga /taiga-back
cmd=( celery -A taiga.celery worker -B --concurrency 4 -l INFO "$@" )

# Start Celery processes
echo Starting Celery...
exec gosu taiga celery -A taiga.celery worker -B \
--concurrency 4 \
-l INFO \
"$@"
if [ "$(id -u)" -eq 0 ]; then
# Give permission to taiga:taiga after mounting volumes
echo Give permission to taiga:taiga
# chown -R taiga:taiga /taiga-back

# Start Celery processes
echo Starting Celery...
exec gosu taiga "${cmd[@]}"
else
# Start Celery processes
echo Starting Celery...
exec "${cmd[@]}"
fi
34 changes: 21 additions & 13 deletions docker/entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@

set -euo pipefail

cmd=( gunicorn taiga.wsgi:application \
--name taiga_api \
--bind 0.0.0.0:8000 \
--workers 3 \
--worker-tmp-dir /dev/shm \
--log-level=info \
--access-logfile - \
"$@" )

# Execute pending migrations
echo Executing pending migrations
python manage.py migrate
Expand All @@ -16,17 +25,16 @@ python manage.py migrate
echo Load default templates
python manage.py loaddata initial_project_templates

# Give permission to taiga:taiga after mounting volumes
echo Give permission to taiga:taiga
chown -R taiga:taiga /taiga-back
if [ "$(id -u)" -eq 0 ]; then
# Give permission to taiga:taiga after mounting volumes
echo Give permission to taiga:taiga
chown -R taiga:taiga /taiga-back

# Start Taiga processes
echo Starting Taiga API...
exec gosu taiga gunicorn taiga.wsgi:application \
--name taiga_api \
--bind 0.0.0.0:8000 \
--workers 3 \
--worker-tmp-dir /dev/shm \
--log-level=info \
--access-logfile - \
"$@"
# Start Taiga processes
echo Starting Taiga API...
exec gosu taiga "${cmd[@]}"
else
# Start Taiga processes
echo Starting Taiga API...
exec "${cmd[@]}"
fi