Skip to content

Commit

Permalink
Testing permissions and uid/gid
Browse files Browse the repository at this point in the history
  • Loading branch information
david-i-berry committed Aug 19, 2024
1 parent 9702b8a commit 3b40464
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 5 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ USER root
RUN chown -R wis2downloader:wis2 /home/wis2downloader/app && \
chmod +x /home/wis2downloader/app/entrypoint.sh && \
chmod 600 /home/wis2downloader/app/clean_downloads.py && \
chmod 600 /home/wis2downloader/app/clean_downloads.cron && \
usermod -aG sudo wis2downloader
chmod 600 /home/wis2downloader/app/clean_downloads.cron

USER wis2downloader

ENTRYPOINT [ "/home/wis2downloader/app/entrypoint.sh" ]

USER wis2downloader
# Set the working directory to /app
WORKDIR /home/wis2downloader
RUN crontab ./app/clean_downloads.cron
Expand All @@ -73,6 +73,7 @@ RUN crontab ./app/clean_downloads.cron
HEALTHCHECK --interval=1m --timeout=3s \
CMD curl -f http://localhost:5000/subscriptions || exit 1

USER wis2downloader
# Final step as root user, updated in entrypoint
USER root
# Run wis2downloader when the container launches
CMD ["/bin/bash", "-c", "gunicorn --bind 0.0.0.0:5000 --workers 1 wis2downloader.app:app"]
3 changes: 1 addition & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
echo "$@"
su - wis2downloader
echo "$(id -u):$(id-g)"
# Update build uid and gid to align with those of instance
sudo "usermod -u $(id -u) wis2downloader"
sudo "groupmod -g $(id -g) wis2"
Expand Down

0 comments on commit 3b40464

Please sign in to comment.