From 41c5d261afa1592b9285599cdf49cb56c93c419a Mon Sep 17 00:00:00 2001 From: Taka Date: Tue, 22 Jun 2021 04:13:56 +1000 Subject: [PATCH] Run the Docker container using the caller's UID/GID. --- Dockerfile | 4 ++++ run-containers.sh | 2 ++ 2 files changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index f268192..cc22d8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,10 @@ RUN rm -f asl_articles/config/debug.cfg # copy the alembic files (so that users can upgrade their database) COPY alembic alembic +# NOTE: We set these so that we can update the database outside the container. +ENV UID=$DOCKER_UID +ENV GID=$DOCKER_GID + # launch the web server EXPOSE 5000 ENV DBCONN undefined diff --git a/run-containers.sh b/run-containers.sh index 6e880dc..41060cf 100755 --- a/run-containers.sh +++ b/run-containers.sh @@ -38,6 +38,8 @@ export AUTHOR_ALIASES= export ENABLE_TESTS= NO_BUILD= export BUILD_NETWORK= +export DOCKER_UID=$(id -u) +export DOCKER_GID=$(id -g) # parse the command-line arguments if [ $# -eq 0 ]; then