Skip to content

Commit 742ce5a

Browse files
authored
chore: make dev container use base image
1 parent 53c1377 commit 742ce5a

5 files changed

Lines changed: 9 additions & 140 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,5 @@
102102
// "postCreateCommand": "sh /docker-init.sh",
103103

104104
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
105-
"remoteUser": "vscode"
105+
"remoteUser": "dev"
106106
}

docker-compose.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ services:
55
build:
66
context: .
77
dockerfile: docker/app.Dockerfile
8-
args:
9-
# Update 'VARIANT' to pick a version of Python: 3, 3.10, 3.9, 3.8, 3.7, 3.6
10-
# Append -bullseye or -buster to pin to an OS version.
11-
# Use -bullseye variants on local arm64/Apple Silicon.
12-
VARIANT: 3.9-bullseye
13-
NODE_VERSION: '16'
148

159
init: true
1610

@@ -33,7 +27,7 @@ services:
3327
# DJANGO_SETTINGS_MODULE: settings_sqlitetest
3428

3529
# Uncomment the next line to use a non-root user for all processes.
36-
# user: vscode
30+
# user: dev
3731

3832
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
3933
# (Adding the "ports" property to this file will not forward from a Codespace.)

docker/app.Dockerfile

Lines changed: 3 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
# Based on image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.236.0/containers/python-3/.devcontainer/base.Dockerfile
2-
3-
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
4-
ARG VARIANT=3-bullseye
5-
FROM python:${VARIANT}
1+
FROM ghcr.io/ietf-tools/datatracker-app-base:latest
62
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"
73

84
ENV DEBIAN_FRONTEND=noninteractive
@@ -17,7 +13,7 @@ ARG INSTALL_ZSH="true"
1713
# [Option] Upgrade OS packages to their latest versions
1814
ARG UPGRADE_PACKAGES="true"
1915
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
20-
ARG USERNAME=vscode
16+
ARG USERNAME=dev
2117
ARG USER_UID=1000
2218
ARG USER_GID=$USER_UID
2319
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
@@ -32,145 +28,23 @@ ENV PIPX_HOME=/usr/local/py-utils \
3228
ENV PATH=${PATH}:${PIPX_BIN_DIR}
3329
RUN bash /tmp/library-scripts/python-debian.sh "none" "/usr/local" "${PIPX_HOME}" "${USERNAME}"
3430

35-
# [Choice] Node.js version: lts, 18, 16, 14, 12, 10
36-
ARG NODE_VERSION="16"
37-
RUN curl -fsSL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash -
38-
RUN apt-get install -y nodejs make gcc g++ && npm install -g yarn
39-
4031
# Remove library scripts for final image
4132
RUN rm -rf /tmp/library-scripts
4233

43-
# Expose port 8000
44-
EXPOSE 8000
45-
46-
# Add Docker Source
47-
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
48-
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
49-
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
50-
51-
# Install the packages we need
52-
RUN apt-get update --fix-missing && apt-get install -qy \
53-
apache2-utils \
54-
apt-file \
55-
apt-utils \
56-
bash \
57-
build-essential \
58-
curl \
59-
default-jdk \
60-
docker-ce-cli \
61-
enscript \
62-
fish \
63-
gawk \
64-
gcc \
65-
ghostscript \
66-
git \
67-
gnupg \
68-
graphviz \
69-
jq \
70-
less \
71-
libcairo2-dev \
72-
libgtk2.0-0 \
73-
libgtk-3-0 \
74-
libnotify-dev \
75-
libgconf-2-4 \
76-
libgbm-dev \
77-
libnss3 \
78-
libxss1 \
79-
libasound2 \
80-
libxtst6 \
81-
libmagic-dev \
82-
libmariadb-dev \
83-
libmemcached-tools \
84-
locales \
85-
mariadb-client \
86-
memcached \
87-
netcat \
88-
nano \
89-
pigz \
90-
pv \
91-
python3-ipython \
92-
ripgrep \
93-
rsync \
94-
rsyslog \
95-
ruby \
96-
ruby-rubygems \
97-
subversion \
98-
unzip \
99-
watchman \
100-
wget \
101-
xauth \
102-
xvfb \
103-
yang-tools \
104-
zsh
105-
106-
# Install kramdown-rfc2629 (ruby)
107-
RUN gem install kramdown-rfc2629
108-
109-
# Install chromedriver if supported
110-
COPY docker/scripts/app-install-chromedriver.sh /tmp/app-install-chromedriver.sh
111-
RUN sed -i 's/\r$//' /tmp/app-install-chromedriver.sh && \
112-
chmod +x /tmp/app-install-chromedriver.sh
113-
RUN /tmp/app-install-chromedriver.sh
114-
115-
# Fix /dev/shm permissions for chromedriver
116-
RUN chmod 1777 /dev/shm
117-
118-
# Get rid of installation files we don't need in the image, to reduce size
119-
RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
120-
121-
# "fake" dbus address to prevent errors
122-
# https://github.com/SeleniumHQ/docker-selenium/issues/87
123-
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
124-
125-
# avoid million NPM install messages
126-
ENV npm_config_loglevel warn
127-
# allow installing when the main user is root
128-
ENV npm_config_unsafe_perm true
129-
# disable NPM funding messages
130-
ENV npm_config_fund false
131-
132-
# Set locale to en_US.UTF-8
133-
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
134-
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
135-
echo "LANG=en_US.UTF-8" > /etc/locale.conf && \
136-
dpkg-reconfigure locales && \
137-
locale-gen en_US.UTF-8 && \
138-
update-locale LC_ALL en_US.UTF-8
139-
ENV LC_ALL en_US.UTF-8
140-
141-
# Install idnits
142-
ADD https://raw.githubusercontent.com/ietf-tools/idnits-mirror/main/idnits /usr/local/bin/
143-
RUN chmod +rx /usr/local/bin/idnits
144-
145-
# Turn off rsyslog kernel logging (doesn't work in Docker)
146-
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
147-
148-
# Colorize the bash shell
149-
RUN sed -i 's/#force_color_prompt=/force_color_prompt=/' /root/.bashrc
150-
151-
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
152-
RUN chmod +rx /usr/local/bin/wait-for
153-
15434
# Copy the startup file
15535
COPY docker/scripts/app-init.sh /docker-init.sh
15636
RUN sed -i 's/\r$//' /docker-init.sh && \
15737
chmod +x /docker-init.sh
15838

159-
# Create workspace
160-
RUN mkdir -p /workspace
161-
WORKDIR /workspace
162-
16339
# Fix user UID / GID to match host
16440
RUN groupmod --gid $USER_GID $USERNAME \
16541
&& usermod --uid $USER_UID --gid $USER_GID $USERNAME \
16642
&& chown -R $USER_UID:$USER_GID /home/$USERNAME \
16743
|| exit 0
16844

169-
USER vscode:vscode
45+
USER dev:dev
17046

17147
# Install current datatracker python dependencies
17248
COPY requirements.txt /tmp/pip-tmp/
17349
RUN pip3 --disable-pip-version-check --no-cache-dir install --user --no-warn-script-location -r /tmp/pip-tmp/requirements.txt
17450
RUN sudo rm -rf /tmp/pip-tmp
175-
176-
# ENTRYPOINT [ "/docker-init.sh" ]

docker/base.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ RUN apt-get update --fix-missing && apt-get install -qy \
6464
ruby \
6565
ruby-rubygems \
6666
unzip \
67+
watchman \
6768
wget \
6869
xauth \
6970
xvfb \

docker/scripts/app-init.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ sudo service rsyslog start
66

77
# Fix ownership of volumes
88
echo "Fixing volumes ownership..."
9-
sudo chown -R vscode:vscode "$WORKSPACEDIR/.parcel-cache"
10-
sudo chown -R vscode:vscode "$WORKSPACEDIR/__pycache__"
9+
sudo chown -R dev:dev "$WORKSPACEDIR/.parcel-cache"
10+
sudo chown -R dev:dev "$WORKSPACEDIR/__pycache__"
1111

1212
# Build node packages that requrie native compilation
1313
echo "Compiling native node packages..."
@@ -73,7 +73,7 @@ fi
7373
# Run memcached
7474

7575
echo "Starting memcached..."
76-
/usr/bin/memcached -u vscode -d
76+
/usr/bin/memcached -u dev -d
7777

7878
# Initial checks
7979

0 commit comments

Comments
 (0)