Skip to content

Commit

Permalink
Merge pull request freifunk-gluon#2975 from freifunk-gluon/docker-uids
Browse files Browse the repository at this point in the history
Fix Dockerfile / container.sh for UID/GID other than 1000
  • Loading branch information
blocktrron authored Sep 11, 2023
2 parents 0db797c + c8bbef8 commit 251392b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion contrib/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ecdsautils \
lua-check \
shellcheck \
libnss-unknown \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -30,7 +31,7 @@ RUN mkdir /tmp/ec &&\
mv bin/ec-linux-amd64 /usr/local/bin/editorconfig-checker &&\
rm -rf /tmp/ec

RUN useradd -d /gluon gluon
RUN useradd -m -d /gluon -u 100 -g 100 -o gluon
USER gluon

VOLUME /gluon
Expand Down
6 changes: 3 additions & 3 deletions scripts/container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ TAG="gluon:${BRANCH:-latest}"
if [ "$(command -v podman)" ]
then
podman build -t "${TAG}" contrib/docker
podman run -it --rm --userns=keep-id --volume="$(pwd):/gluon" "${TAG}"
podman run -it --rm -u "$(id -u):$(id -g)" --userns=keep-id --volume="$(pwd):/gluon" "${TAG}"
elif [ "$(command -v docker)" ]
then
docker build -t "${TAG}" contrib/docker
docker run -it --rm --volume="$(pwd):/gluon" "${TAG}"
docker run -it --rm -u "$(id -u):$(id -g)" --volume="$(pwd):/gluon" -e HOME=/gluon "${TAG}"
else
1>&2 echo "Please install either podman or docker. Exiting" >/dev/null
echo "Please install either podman or docker. Exiting" >&2
exit 1
fi

0 comments on commit 251392b

Please sign in to comment.