From 77414a63116fc2740d0ae9139ced783ac31eb179 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Sun, 19 Mar 2023 11:41:49 +0000 Subject: [PATCH 1/2] tidy local docker build script --- .devcontainer/Dockerfile | 2 -- .devcontainer/local_build.sh | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index aa754bc3..67147f14 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -22,8 +22,6 @@ RUN apt-get update && \ WORKDIR /workspace COPY . . -# install runtime from DIST if there is one - # install runtime from DIST if there is one RUN mkdir -vp /root/.local && \ if [ -d dist ] ; then \ diff --git a/.devcontainer/local_build.sh b/.devcontainer/local_build.sh index 9dba8261..106fec34 100755 --- a/.devcontainer/local_build.sh +++ b/.devcontainer/local_build.sh @@ -1,18 +1,22 @@ # locally build a runtime container for testing +THIS_DIR=$(dirname $(realpath $0)) +PYTHON_ROOT=$(realpath $THIS_DIR/..) + # first make sure a wheel is built ( - cd .. + cd ${PYTHON_ROOT} pip install build rm -r dist python -m build --wheel ) # make the container name the same as the root folder name of this clone -container_name=$(cd ..; basename $(realpath .)) +container_name=$(cd ${PYTHON_ROOT} ; basename $(realpath .)) echo building $container_name ... # run the build with required build-args for a runtime build +cd ${THIS_DIR} ln -s ../dist . docker build --build-arg BASE=python:3.10-slim -t $container_name .. --file ./Dockerfile unlink dist From ddeb21d6c36961bafc5848447562551200fe23a5 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Sun, 19 Mar 2023 15:53:01 +0000 Subject: [PATCH 2/2] fix non-root user case --- .devcontainer/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 67147f14..7c17f271 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -38,7 +38,8 @@ RUN mkdir -vp /root/.config /config \ && mkdir -vp /storage # make the installed version of gphotos-sync available to non root users -RUN chmod -R a+rx /root/.local +RUN chmod -R a+rx /root +ENV HOME=/root VOLUME /config /storage