Skip to content

Commit 7023445

Browse files
authored
Merge pull request #12 from joyeecheung/fix-dockerfile
fix: fix Dockerfile
2 parents f2469c6 + 5c432e3 commit 7023445

File tree

4 files changed

+31
-12
lines changed

4 files changed

+31
-12
lines changed

Dockerfile

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
FROM ubuntu:latest AS build
22

3-
RUN groupadd --gid 1000 developer \
4-
&& useradd --uid 1000 --gid developer --shell /bin/bash --create-home developer
3+
ARG USER_UID=900
4+
ARG USER_GID=$USER_UID
5+
6+
# Create the non-root user and grant NOPASSWD sudo
7+
RUN groupadd --gid $USER_GID developer
8+
RUN useradd --uid $USER_UID --gid $USER_GID --shell /bin/bash --create-home developer
9+
10+
# Install sudo first
11+
RUN apt-get update
12+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends sudo
13+
14+
# No Sudo Prompt - thanks Electron for this
15+
RUN echo 'developer ALL=NOPASSWD: ALL' >> /etc/sudoers.d/developer
16+
RUN echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
517

618
ENV DEBIAN_FRONTEND=1
7-
ENV PATH /usr/lib/ccache:$PATH
19+
ENV PATH=/usr/lib/ccache:$PATH
820

921
COPY --chown=root:developer ./scripts/ /home/developer/scripts/
10-
RUN /home/developer/scripts/install.sh && /home/developer/scripts/mkdir.sh && /home/developer/scripts/ccache.sh && /home/developer/scripts/clone.sh && /home/developer/scripts/build.sh && make install -C /home/developer/nodejs/node && /home/developer/scripts/ncu.sh
22+
RUN /home/developer/scripts/install.sh
23+
RUN /home/developer/scripts/mkdir.sh
24+
RUN /home/developer/scripts/ccache.sh
25+
RUN /home/developer/scripts/clone.sh
26+
RUN /home/developer/scripts/build.sh
27+
RUN make install -C /home/developer/nodejs/node
28+
RUN /home/developer/scripts/ncu.sh
1129

1230
WORKDIR /home/developer/nodejs/node

TODO.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
- [x] Switch to `node:latest`
22
- [x] Install `node-core-utils`
3-
- [x] Documentation
3+
- [x] Documentation
4+
- [ ] Split into multiple stages https://github.com/nodejs/devcontainer/pull/12#discussion_r2375074158
5+
- [ ] Reuse Dockerfile bits from https://github.com/nodejs/build/blob/main/ansible/roles/docker/templates

scripts/install.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ package_list="
88
curl \
99
nano \
1010
python3 \
11-
python-setuptools \
1211
python3-pip \
12+
python-is-python3 \
1313
ninja-build \
1414
g++ \
15-
sudo \
15+
gcc \
16+
g++-12 \
17+
gcc-12 \
1618
make \
1719
git \
20+
pkg-config \
1821
locales \
1922
gpg \
2023
wget"
@@ -29,7 +32,3 @@ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githu
2932
gh_package_list="gh"
3033
apt-get update
3134
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $gh_package_list
32-
33-
# No Sudo Prompt - thanks Electron for this
34-
echo 'developer ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-developer
35-
echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep

scripts/ncu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e # Exit with nonzero exit code if anything fails
44

5-
npm install -g node-core-utils
5+
npm install -g @node-core/utils
66

77
ncu-config set upstream upstream
88
ncu-config set branch main

0 commit comments

Comments
 (0)