Skip to content

Commit d8a6158

Browse files
authored
Chore: [AEA-0000] - docker gid fix for Linux (#37)
## Summary - 🤖 Operational or Infrastructure Change ### Details Docker group id on host and container need to be the same. Similar fix already rolled out in psu, account resources etc.
1 parent d287a67 commit d8a6158

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

.devcontainer/Dockerfile

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
FROM mcr.microsoft.com/devcontainers/base:ubuntu
22

3+
# provide DOCKER_GID via build args if you need to force group id to match host
4+
ARG DOCKER_GID
5+
6+
# specify DOCKER_GID to force container docker group id to match host
7+
RUN if [ -n "${DOCKER_GID}" ]; then \
8+
if ! getent group docker; then \
9+
groupadd -g ${DOCKER_GID} docker; \
10+
else \
11+
groupmod -g ${DOCKER_GID} docker; \
12+
fi && \
13+
usermod -aG docker vscode; \
14+
fi
15+
16+
# Anticipate and resolve potential permission issues with apt
17+
RUN mkdir -p /tmp && chmod 1777 /tmp
18+
319
RUN apt-get update \
420
&& export DEBIAN_FRONTEND=noninteractive \
521
&& apt-get -y dist-upgrade \
@@ -14,24 +30,24 @@ RUN apt-get update \
1430
USER vscode
1531

1632
# Install ASDF
17-
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3; \
18-
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc; \
19-
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc;
33+
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3 && \
34+
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc && \
35+
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
2036

2137
ENV PATH="$PATH:/home/vscode/.asdf/bin/:/workspaces/eps-prescription-tracker-ui/node_modules/.bin:/workspaces/eps-workflow-quality-checks/.venv/bin"
2238

2339
# Install ASDF plugins#
24-
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git; \
25-
asdf plugin add actionlint; \
26-
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git; \
27-
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git; \
40+
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git && \
41+
asdf plugin add actionlint && \
42+
asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git && \
43+
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git && \
2844
asdf plugin add python
2945

3046
WORKDIR /workspaces/eps-workflow-quality-checks
3147

3248
ADD .tool-versions /workspaces/eps-workflow-quality-checks/.tool-versions
3349
ADD .tool-versions /home/vscode/.tool-versions
3450

35-
RUN asdf install python; \
36-
asdf install; \
37-
asdf reshim nodejs;
51+
RUN asdf install python && \
52+
asdf install && \
53+
asdf reshim nodejs

.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
"context": "..",
9-
"args": {}
9+
"args": {
10+
"DOCKER_GID": "${env:DOCKER_GID:}"
11+
}
1012
},
1113
"mounts": [
1214
"source=${env:HOME}${env:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind",

0 commit comments

Comments
 (0)