Skip to content

Commit d8e766e

Browse files
authored
Merge pull request #416 from symflower/415-svg-renderer
Replace "Inkscape" with "svgexport"
2 parents f01d95b + 2427e79 commit d8e766e

File tree

3 files changed

+59
-44
lines changed

3 files changed

+59
-44
lines changed

.github/workflows/job-container-image-build.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,22 @@ jobs:
4242
push: true
4343
cache-from: type=gha
4444
cache-to: type=gha,mode=max
45+
46+
test:
47+
runs-on: ubuntu-latest
48+
needs: docker
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
- name: Run tests from Docker image
55+
run: |
56+
output=$(docker run -v ./docs:/app/svg --user $(id -u):1000 --rm ghcr.io/symflower/eval-dev-quality:${GITHUB_SHA::7} svgexport /app/svg/cta.svg /app/svg/cta.png)
57+
58+
expected="/app/svg/cta.svg /app/svg/cta.png png 100% 1x 0:0:1920:400 1920:400"
59+
if [ "$output" == "$expected" ]; then
60+
exit 0
61+
else
62+
exit 1
63+
fi

Dockerfile

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,44 @@ RUN CGO_ENABLED=0 go build -o eval-dev-quality ./cmd/eval-dev-quality
1212
FROM ubuntu:noble
1313
RUN apt-get update && \
1414
apt-get install -y \
15+
--no-install-recommends \
1516
ca-certificates \
1617
gcc \
1718
git \
19+
imagemagick \
20+
libappindicator3-1 \
21+
libasound2-data \
22+
libasound2-plugins \
23+
libatk-bridge2.0-0 \
24+
libatk1.0-0 \
25+
libdrm2 \
26+
libgbm1 \
27+
libgtk-3-0 \
28+
libnss3 \
1829
libssl-dev \
1930
libtool \
31+
libx11-6 \
32+
libx11-xcb1 \
33+
libxcb-dri3-0 \
34+
libxss1 \
35+
libxtst6 \
2036
libyaml-dev \
2137
make \
38+
nodejs \
39+
npm \
40+
pngcrush \
2241
unzip \
2342
wget \
2443
zlib1g-dev \
2544
&& update-ca-certificates
2645

46+
# Install "Chrome for testing" as puppeteer requirement.
47+
RUN wget https://storage.googleapis.com/chrome-for-testing-public/133.0.6943.53/linux64/chrome-linux64.zip -O /tmp/chrome-linux64.zip && \
48+
mkdir -p /opt/chrome && \
49+
unzip /tmp/chrome-linux64.zip -d /opt/chrome && \
50+
rm /tmp/chrome-linux64.zip
51+
ENV PATH="${PATH}:/opt/chrome/chrome-linux64"
52+
2753
# Switch to the ubuntu user as we want it to run as non-root.
2854
USER ubuntu
2955
WORKDIR /app
@@ -32,7 +58,7 @@ COPY --chown=ubuntu:ubuntu ./Makefile ./Makefile
3258
RUN mkdir -p .eval-dev-quality
3359
RUN mkdir -p /app/evaluation
3460

35-
# Install Ruby
61+
# Install Ruby.
3662
RUN mkdir -p /tmp/compile
3763
RUN wget https://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz && \
3864
tar -xf ruby-3.3.4.tar.gz -C /tmp/compile/ && \
@@ -44,34 +70,42 @@ WORKDIR /app
4470
RUN rm -rf /tmp/compile
4571
ENV PATH="${PATH}:/app/.eval-dev-quality/ruby-3.3.4/bin"
4672

47-
# Install Maven
73+
# Install Maven.
4874
RUN wget https://archive.apache.org/dist/maven/maven-3/3.9.1/binaries/apache-maven-3.9.1-bin.tar.gz && \
4975
tar -xf apache-maven-3.9.1-bin.tar.gz -C /app/.eval-dev-quality/ && \
5076
rm apache-maven-3.9.1-bin.tar.gz
5177
ENV PATH="${PATH}:/app/.eval-dev-quality/apache-maven-3.9.1/bin"
5278

53-
# Install Gradle
79+
# Install Gradle.
5480
RUN wget https://services.gradle.org/distributions/gradle-8.0.2-bin.zip && \
5581
unzip gradle-8.0.2-bin.zip -d /app/.eval-dev-quality/ && \
5682
rm gradle-8.0.2-bin.zip
5783
ENV PATH="${PATH}:/app/.eval-dev-quality/gradle-8.0.2/bin"
5884

59-
# Install Java
85+
# Install Java.
6086
RUN wget https://corretto.aws/downloads/resources/11.0.24.8.1/amazon-corretto-11.0.24.8.1-linux-x64.tar.gz && \
6187
tar -xf amazon-corretto-11.0.24.8.1-linux-x64.tar.gz -C /app/.eval-dev-quality/ && \
6288
rm amazon-corretto-11.0.24.8.1-linux-x64.tar.gz
6389
ENV JAVA_HOME="/app/.eval-dev-quality/amazon-corretto-11.0.24.8.1-linux-x64"
6490
ENV PATH="${PATH}:${JAVA_HOME}/bin"
6591

66-
# Install Go
92+
# Install Go.
6793
RUN wget https://go.dev/dl/go1.23.6.linux-amd64.tar.gz && \
6894
tar -xf go1.23.6.linux-amd64.tar.gz -C /app/.eval-dev-quality/ && \
6995
rm go1.23.6.linux-amd64.tar.gz
7096
ENV PATH="${PATH}:/app/.eval-dev-quality/go/bin"
7197
ENV GOROOT="/app/.eval-dev-quality/go"
7298
ENV PATH="${PATH}:/home/ubuntu/go/bin"
7399

74-
# Install the binary
100+
# Setup NPM global store in User space and install NPM packages.
101+
ENV NPM_CONFIG_PREFIX=/home/ubuntu/.npm-global
102+
ENV PATH="${PATH}:/home/ubuntu/.npm-global/bin"
103+
RUN npm install svgexport -g
104+
105+
# Only use a single process for the puppeteer chrome instance to avoid memory issues in containerized environments.
106+
RUN sed -i "s/args: \[\(.*\)\]/args: [\1, '--single-process']/" /home/ubuntu/.npm-global/lib/node_modules/svgexport/render.js
107+
108+
# Install the binary.
75109
COPY --from=builder --chown=ubuntu:ubuntu /app/eval-dev-quality /app/.eval-dev-quality/bin/
76110
ENV PATH="${PATH}:/app/.eval-dev-quality/bin"
77111
RUN make install-tools-testing

scripts/convert_svg_to_png.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)