Skip to content

Commit b9cf35c

Browse files
committed
use a different user id
1 parent 73970e5 commit b9cf35c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.github/workflows/build_multi_arch_image.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ jobs:
8787
BASE_VERSION: ${{ inputs.docker_tag}}
8888
IMAGE_TAG: ":${{ inputs.docker_tag }}-${{ matrix.arch }}"
8989
BASE_FOLDER: "${{ inputs.base_folder }}"
90+
VSCODE_UID: "1001"
91+
VSCODE_GID: "1001"
9092
- name: Check docker vulnerabilities - json output
9193
uses: aquasecurity/trivy-action@c1824fd6edce30d7ab345a9989de00bbd46ef284
9294
with:

src/base/.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ COPY .tool-versions.asdf ${SCRIPTS_DIR}/${CONTAINER_NAME}/.tool-versions.asdf
1717
COPY --chmod=755 scripts ${SCRIPTS_DIR}/${CONTAINER_NAME}
1818
WORKDIR ${SCRIPTS_DIR}/${CONTAINER_NAME}
1919
RUN ./root_install.sh
20+
RUN requested_uid="${VSCODE_UID:-1000}" \
21+
&& requested_gid="${VSCODE_GID:-1000}" \
22+
&& current_uid="$(id -u vscode)" \
23+
&& current_gid="$(id -g vscode)" \
24+
&& if [ "${current_gid}" != "${requested_gid}" ]; then groupmod -g "${requested_gid}" vscode; fi \
25+
&& if [ "${current_uid}" != "${requested_uid}" ]; then usermod -u "${requested_uid}" -g "${requested_gid}" vscode; fi \
26+
&& chown -R vscode:vscode /home/vscode
2027

2128
USER vscode
2229

src/base/.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"build": {
77
"dockerfile": "Dockerfile",
88
"args": {
9-
"CONTAINER_NAME": "eps_devcontainer_base"
9+
"CONTAINER_NAME": "eps_devcontainer_base",
10+
"VSCODE_UID": "${localEnv:VSCODE_UID}",
11+
"VSCODE_GID": "${localEnv:VSCODE_GID}"
1012
}
1113
},
1214
"runArgs": [

0 commit comments

Comments
 (0)