Skip to content

Commit f516f86

Browse files
authored
ci: Add vnu to dev + test docker image (ietf-tools#3724)
* ci: Add vnu to dev docker image * Use default-jdk from apt, and just download the vnu JAR blob
1 parent 841f289 commit f516f86

4 files changed

Lines changed: 132 additions & 128 deletions

File tree

dev/docker-test-base/Dockerfile

Lines changed: 127 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,127 @@
1-
FROM python:3.6-bullseye
2-
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"
3-
4-
ENV DEBIAN_FRONTEND=noninteractive
5-
6-
7-
RUN apt-get update
8-
RUN apt-get -qy upgrade
9-
10-
# Add Node.js Source
11-
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
12-
13-
# Add Docker Source
14-
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
15-
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
16-
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
17-
18-
# Install the packages we need
19-
RUN apt-get update
20-
RUN apt-get install -qy \
21-
apache2-utils \
22-
apt-file \
23-
apt-utils \
24-
bash \
25-
build-essential \
26-
curl \
27-
docker-ce-cli \
28-
enscript \
29-
gawk \
30-
gcc \
31-
ghostscript \
32-
git \
33-
gnupg \
34-
graphviz \
35-
jq \
36-
less \
37-
libcairo2-dev \
38-
libgtk2.0-0 \
39-
libgtk-3-0 \
40-
libnotify-dev \
41-
libgconf-2-4 \
42-
libgbm-dev \
43-
libnss3 \
44-
libxss1 \
45-
libasound2 \
46-
libxtst6 \
47-
libmagic-dev \
48-
libmariadb-dev \
49-
libtidy-dev \
50-
locales \
51-
mariadb-client \
52-
netcat \
53-
nodejs \
54-
pigz \
55-
pv \
56-
python3-ipython \
57-
ripgrep \
58-
rsync \
59-
rsyslog \
60-
ruby \
61-
ruby-rubygems \
62-
unzip \
63-
wget \
64-
xauth \
65-
xvfb \
66-
yang-tools
67-
68-
# Install kramdown-rfc2629 (ruby)
69-
RUN gem install kramdown-rfc2629
70-
71-
# Install chromedriver
72-
COPY docker/scripts/app-install-chromedriver.sh /tmp/app-install-chromedriver.sh
73-
RUN sed -i 's/\r$//' /tmp/app-install-chromedriver.sh && \
74-
chmod +x /tmp/app-install-chromedriver.sh
75-
RUN /tmp/app-install-chromedriver.sh
76-
77-
# Get rid of installation files we don't need in the image, to reduce size
78-
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
79-
80-
# "fake" dbus address to prevent errors
81-
# https://github.com/SeleniumHQ/docker-selenium/issues/87
82-
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
83-
84-
# avoid million NPM install messages
85-
ENV npm_config_loglevel warn
86-
# allow installing when the main user is root
87-
ENV npm_config_unsafe_perm true
88-
# disable NPM funding messages
89-
ENV npm_config_fund false
90-
91-
# Set locale to en_US.UTF-8
92-
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
93-
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
94-
echo "LANG=en_US.UTF-8" > /etc/locale.conf && \
95-
dpkg-reconfigure locales && \
96-
locale-gen en_US.UTF-8 && \
97-
update-locale LC_ALL en_US.UTF-8
98-
ENV LC_ALL en_US.UTF-8
99-
100-
# Install idnits
101-
ADD https://raw.githubusercontent.com/ietf-tools/idnits-mirror/main/idnits /usr/local/bin/
102-
RUN chmod +rx /usr/local/bin/idnits
103-
104-
# Install current datatracker python dependencies
105-
COPY requirements.txt /tmp/pip-tmp/
106-
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
107-
&& rm -rf /tmp/pip-tmp
108-
109-
# Turn off rsyslog kernel logging (doesn't work in Docker)
110-
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
111-
112-
# Fetch wait-for utility
113-
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
114-
RUN chmod +rx /usr/local/bin/wait-for
115-
116-
# Create workspace
117-
RUN mkdir -p /workspace
118-
WORKDIR /workspace
119-
120-
# Install NPM modules
121-
COPY package.json package.json
122-
RUN npm install --no-audit
123-
RUN rm -f package.json package-lock.json
1+
FROM python:3.6-bullseye
2+
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
7+
RUN apt-get update
8+
RUN apt-get -qy upgrade
9+
10+
# Add Node.js Source
11+
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
12+
13+
# Add Docker Source
14+
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
15+
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
16+
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
17+
18+
# Install the packages we need
19+
RUN apt-get update
20+
RUN apt-get install -qy \
21+
apache2-utils \
22+
apt-file \
23+
apt-utils \
24+
bash \
25+
build-essential \
26+
curl \
27+
docker-ce-cli \
28+
default-jdk \
29+
enscript \
30+
gawk \
31+
gcc \
32+
ghostscript \
33+
git \
34+
gnupg \
35+
graphviz \
36+
jq \
37+
less \
38+
libcairo2-dev \
39+
libgtk2.0-0 \
40+
libgtk-3-0 \
41+
libnotify-dev \
42+
libgconf-2-4 \
43+
libgbm-dev \
44+
libnss3 \
45+
libxss1 \
46+
libasound2 \
47+
libxtst6 \
48+
libmagic-dev \
49+
libmariadb-dev \
50+
libtidy-dev \
51+
locales \
52+
mariadb-client \
53+
netcat \
54+
nodejs \
55+
pigz \
56+
pv \
57+
python3-ipython \
58+
ripgrep \
59+
rsync \
60+
rsyslog \
61+
ruby \
62+
ruby-rubygems \
63+
unzip \
64+
wget \
65+
xauth \
66+
xvfb \
67+
yang-tools
68+
69+
# Install kramdown-rfc2629 (ruby)
70+
RUN gem install kramdown-rfc2629
71+
72+
# Install chromedriver
73+
COPY docker/scripts/app-install-chromedriver.sh /tmp/app-install-chromedriver.sh
74+
RUN sed -i 's/\r$//' /tmp/app-install-chromedriver.sh && \
75+
chmod +x /tmp/app-install-chromedriver.sh
76+
RUN /tmp/app-install-chromedriver.sh
77+
78+
# Get rid of installation files we don't need in the image, to reduce size
79+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
80+
81+
# "fake" dbus address to prevent errors
82+
# https://github.com/SeleniumHQ/docker-selenium/issues/87
83+
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
84+
85+
# avoid million NPM install messages
86+
ENV npm_config_loglevel warn
87+
# allow installing when the main user is root
88+
ENV npm_config_unsafe_perm true
89+
# disable NPM funding messages
90+
ENV npm_config_fund false
91+
92+
# Set locale to en_US.UTF-8
93+
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
94+
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
95+
echo "LANG=en_US.UTF-8" > /etc/locale.conf && \
96+
dpkg-reconfigure locales && \
97+
locale-gen en_US.UTF-8 && \
98+
update-locale LC_ALL en_US.UTF-8
99+
ENV LC_ALL en_US.UTF-8
100+
101+
# Install idnits
102+
ADD https://raw.githubusercontent.com/ietf-tools/idnits-mirror/main/idnits /usr/local/bin/
103+
RUN chmod +rx /usr/local/bin/idnits
104+
105+
# Install current datatracker python dependencies
106+
COPY requirements.txt /tmp/pip-tmp/
107+
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
108+
&& rm -rf /tmp/pip-tmp
109+
110+
# Turn off rsyslog kernel logging (doesn't work in Docker)
111+
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
112+
113+
# Install the Nu Html Checker (v.Nu)
114+
ADD ADD https://github.com/validator/validator/releases/download/latest/vnu.jar /
115+
116+
# Fetch wait-for utility
117+
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
118+
RUN chmod +rx /usr/local/bin/wait-for
119+
120+
# Create workspace
121+
RUN mkdir -p /workspace
122+
WORKDIR /workspace
123+
124+
# Install NPM modules
125+
COPY package.json package.json
126+
RUN npm install --no-audit
127+
RUN rm -f package.json package-lock.json

docker/app.Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ RUN apt-get install -qy \
3131
bash \
3232
build-essential \
3333
curl \
34+
default-jdk \
3435
docker-ce-cli \
3536
enscript \
3637
fish \
@@ -125,10 +126,7 @@ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
125126
RUN sed -i 's/#force_color_prompt=/force_color_prompt=/' /root/.bashrc
126127

127128
# Install the Nu Html Checker (v.Nu)
128-
ADD https://github.com/validator/validator/releases/download/latest/vnu.linux.zip /
129-
RUN unzip -d / /vnu.linux.zip
130-
RUN cp -r /vnu-runtime-image/* /usr/local
131-
RUN rm -rf /vnu.linux.zip /vnu-runtime-image
129+
ADD https://github.com/validator/validator/releases/download/latest/vnu.jar /
132130

133131
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
134132
RUN chmod +rx /usr/local/bin/wait-for

ietf/utils/test_runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,8 @@ def setup_test_environment(self, **kwargs):
634634
settings.VNU = subprocess.Popen(
635635
[
636636
"java",
637+
"-jar",
638+
"/vnu.jar",
637639
"-Dnu.validator.servlet.bind-address=127.0.0.1",
638640
"nu.validator.servlet.Main",
639641
"8888",

ietf/utils/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def get(self, path, *args, skip_verify=False, **extra):
192192
if settings.VNU:
193193
# First, run through https://validator.github.io/validator/
194194
result = subprocess.run(
195-
["java", "nu.validator.client.HttpClient", "-"],
195+
["java", "-jar", "/vnu.jar", "nu.validator.client.HttpClient", "-"],
196196
input=r.content,
197197
stdout=subprocess.PIPE,
198198
stderr=subprocess.DEVNULL,

0 commit comments

Comments
 (0)