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

Commit

Permalink
Merge pull request #421 from gilesknap/dev
Browse files Browse the repository at this point in the history
Fix non root user container usage
  • Loading branch information
gilesknap authored Mar 19, 2023
2 parents 6993bad + ddeb21d commit a631449
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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

0 comments on commit a631449

Please sign in to comment.