Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Fix non root user container usage #421

Merged
merged 2 commits into from
Mar 19, 2023
Merged
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
5 changes: 2 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -40,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

Expand Down
8 changes: 6 additions & 2 deletions .devcontainer/local_build.sh
Original file line number Diff line number Diff line change
@@ -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