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

Container nonroot #3

Open
wants to merge 2 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 @@ -53,7 +53,8 @@ RUN set -eux; \
# create taiga group and user to use it and give permissions over the code (in entrypoint)
groupadd --system taiga --gid=999; \
useradd --system --no-create-home --gid taiga --uid=999 --shell=/bin/bash taiga; \
chown -R taiga:taiga /taiga-protected; \
chown -R taiga:0 /taiga-protected; \
chmod -R g+rwX /taiga-protected; \
# remove unneeded files and packages
apt-get purge -y \
build-essential \
Expand Down
39 changes: 23 additions & 16 deletions docker/entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,29 @@

set -euo pipefail

cmd=(gunicorn server:app \
--name taiga_protected \
--bind 0.0.0.0:8003 \
--workers 4 \
--worker-tmp-dir /dev/shm \
--max-requests 3600 \
--max-requests-jitter 360 \
--timeout 60 \
--log-level=info \
--access-logfile - \
"$@" )

# Give permission to taiga:taiga after mounting volumes
echo Give permission to taiga:taiga
chown -R taiga:taiga /taiga-protected

# Start Taiga processes
echo Starting Taiga Protected
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-protected

exec gosu taiga gunicorn server:app \
--name taiga_protected \
--bind 0.0.0.0:8003 \
--workers 4 \
--worker-tmp-dir /dev/shm \
--max-requests 3600 \
--max-requests-jitter 360 \
--timeout 60 \
--log-level=info \
--access-logfile - \
"$@"
# Start Taiga processes
echo Starting Taiga Protected
exec gosu taiga "${cmd[@]}"
else
# Start Taiga processes
echo Starting Taiga Protected
exec "${cmd[@]}"
fi