For our production deployment, I do not want to run the container with
elevated privileges. Instead, allow specifying a user a build argument,
add the required chown statements for paths that should be writable
during production and switch the nginx port to a port from the
unprivileged port range so that non-root users can bind to it.
This allows successfully running the container using the following
command line:
docker run -d \
--publish 8080:8080 \
--user=$uid:$gid \
--env-file=env \
-v /postgres/socket/dir:/postgres/socket/dir \
-v /etc/passwd:/etc/passwd:ro \
--name=macports-webapp macports-webapp
Commands like migrate and collectstatic should always run when the
container is (re)started. Other commands like load and cron
should be started manually.
Closes: https://github.com/macports/macports-webapp/pull/32