Skip to content

Commit

Permalink
Merge pull request #172 from entelecheia/main
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia authored Apr 4, 2024
2 parents 88663e7 + d2dc310 commit 174cde8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .copier-docker-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; do NOT edit manually
_commit: v0.29.3-5-gb3044be
_commit: v0.29.4-2-g7c35c83
_src_path: .
app_dirname: entelecheia
app_install_root: /opt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ ENV USER_GID $ARG_USER_GID
# Creates a non-root user with sudo privileges
# check if user exists and if not, create user
RUN if id -u $USERNAME >/dev/null 2>&1; then \
echo "User exists"; \
# if the current user's user id is different from the specified user id, change the user id of the current user to the specified user id
if [ "$USER_UID" -ne "$(id -u $USERNAME)" ]; then \
usermod --uid $USER_UID --gid $USER_GID $USERNAME; \
fi; \
else \
groupadd --gid $USER_GID $USERNAME && \
adduser --uid $USER_UID --gid $USER_GID --force-badname --disabled-password --gecos "" $USERNAME && \
Expand Down Expand Up @@ -103,8 +106,11 @@ RUN sh -c "$(wget -qO- https://dotfiles.entelecheia.ai/install)"
{%- endif %}

USER root
RUN chown --recursive "${USER_UID}:${USER_GID}" "${WORKSPACE_ROOT}"
RUN chown --recursive "${USER_UID}:${USER_GID}" "${APP_INSTALL_ROOT}"
# if the user id is different from the specified user id, change the owner of the workspace to the specified user id
RUN if [ "$USER_UID" -ne "$(id -u $USERNAME)" ]; then \
chown --recursive $USER_UID:$USER_UID $WORKSPACE_ROOT; \
chown --recursive $USER_UID:$USER_UID $APP_INSTALL_ROOT; \
fi
USER $USERNAME

# Specifies the command that will be executed when the container is run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
type=raw,value=${{ env.IMAGE_VERSION }}-${{ env.IMAGE_VARIANT }}
# set latest tag for docker branch
type=raw,value=latest-${{ env.IMAGE_VARIANT }}
type=raw,value=latest

# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
Expand Down
12 changes: 9 additions & 3 deletions .docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ ENV USER_GID $ARG_USER_GID
# Creates a non-root user with sudo privileges
# check if user exists and if not, create user
RUN if id -u $USERNAME >/dev/null 2>&1; then \
echo "User exists"; \
# if the current user's user id is different from the specified user id, change the user id of the current user to the specified user id
if [ "$USER_UID" -ne "$(id -u $USERNAME)" ]; then \
usermod --uid $USER_UID --gid $USER_GID $USERNAME; \
fi; \
else \
groupadd --gid $USER_GID $USERNAME && \
adduser --uid $USER_UID --gid $USER_GID --force-badname --disabled-password --gecos "" $USERNAME && \
Expand Down Expand Up @@ -98,8 +101,11 @@ USER $USERNAME
RUN sh -c "$(wget -qO- https://dotfiles.entelecheia.ai/install)"

USER root
RUN chown --recursive "${USER_UID}:${USER_GID}" "${WORKSPACE_ROOT}"
RUN chown --recursive "${USER_UID}:${USER_GID}" "${APP_INSTALL_ROOT}"
# if the user id is different from the specified user id, change the owner of the workspace to the specified user id
RUN if [ "$USER_UID" -ne "$(id -u $USERNAME)" ]; then \
chown --recursive $USER_UID:$USER_UID $WORKSPACE_ROOT; \
chown --recursive $USER_UID:$USER_UID $APP_INSTALL_ROOT; \
fi
USER $USERNAME

# Specifies the command that will be executed when the container is run
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy-base-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
type=raw,value=${{ env.IMAGE_VERSION }}-${{ env.IMAGE_VARIANT }}
# set latest tag for docker branch
type=raw,value=latest-${{ env.IMAGE_VARIANT }}
type=raw,value=latest
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
Expand Down

0 comments on commit 174cde8

Please sign in to comment.