Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

Commit 8ccc3ad

Browse files
authored
fullstacked with chromium (#28)
1 parent 7e437d3 commit 8ccc3ad

File tree

5 files changed

+68
-7
lines changed

5 files changed

+68
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Available Tags:
1717
| `latest-base` | libffi-dev, libicu-dev, build-essential, libssl-dev, ca-certificates, jq, sed, grep, git, curl, wget, zip | Base runner with nothing fancy installed <br> [Dockerfile](images/base/Dockerfile) |
1818
| `latest-kaniko-sidecar` | kaniko | Sidecar used by other runner images to build containers without root privileges |
1919
| `latest-ansible-k8s` | base-image + ansible, helm, kubectl, skopeo | Runner specialized for automated k8s deployments via ansible <br> For more Details see [Dockerfile](images/ansible-k8s/Dockerfile) |
20-
| `latest-fullstacked` | base-image + ansible, helm, maven, openjdk-11, nodejs, go, yarn, angular/cli | Runner with a bunch of tools to build your hole application<br> For more Details see [Dockerfile](images/fullstacked/Dockerfile) |
20+
| `latest-fullstacked` | base-image + ansible, helm, maven, temurin-11, nodejs, go, yarn, angular/cli, chromium | Runner with a bunch of tools to build your hole application<br> For more Details see [Dockerfile](images/fullstacked/Dockerfile) |
2121

2222
> Hint: `latest` can be replaced with an specific release version for more stability in your environment.
2323

images/fullstacked/Dockerfile

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1-
FROM ghcr.io/fullstack-devops/github-actions-runner:base-latest
1+
FROM ghcr.io/fullstack-devops/github-actions-runner:latest-base
22

33
USER root
44
# install packages along with jq so we can parse JSON
55
# add additional packages as necessary
6-
ARG PACKAGES="temurin-11-jdk maven nodejs ansible"
6+
ARG PACKAGES="temurin-11-jdk maven nodejs ansible chromium python3-selenium xvfb"
77
ARG PACKAGES_PYTHON="kubernetes"
88

9+
## ansible keys
910
RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add -
1011
RUN echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
1112

13+
## helper for karma and chromium
14+
ENV CHROME_BIN="/usr/bin/chromium"
15+
ADD xvfb-chromium /usr/bin/xvfb-chromium
16+
ADD xvfb-chromium-webgl /usr/bin/xvfb-chromium-webgl
17+
ADD display-chromium /usr/bin/display-chromium
18+
19+
RUN chmod +x /usr/bin/display-chromium /usr/bin/xvfb-chromium-webgl /usr/bin/xvfb-chromium
20+
1221
RUN apt-get update \
1322
&& add-apt-repository -y --update ppa:ansible/ansible \
23+
&& add-apt-repository -y --update ppa:xtradeb/apps \
1424
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
1525
&& apt-get install -y --no-install-recommends ${PACKAGES} \
1626
&& rm -rf /var/lib/apt/lists/* \
@@ -37,20 +47,24 @@ RUN export ARCH=$(/helper-scripts/translate-aarch.sh a-short) \
3747

3848
ENV TMP_DIR=/home/${USERNAME}/tmp
3949

50+
RUN mkdir /run/user/$USERID
4051
RUN mkdir /home/${USERNAME}/.ansible
4152
RUN mkdir ${TMP_DIR}
4253

4354
COPY requirements.yml ${TMP_DIR}/requirements.yml
4455

4556
RUN mkdir -p /home/${USERNAME}/.m2/ \
46-
&& chown -R ${USERNAME} /home/${USERNAME}
57+
&& chown -R $USERNAME /home/$USERNAME \
58+
&& chown -R $USERNAME /run/user/$USERID
4759

4860
# install npm tools: yarn
49-
RUN npm install --global yarn @angular/cli@13
61+
ENV NPM_CONFIG_LOGLEVEL=warn NG_CLI_ANALYTICS=false
62+
RUN npm install --location=global yarn pnpm @angular/cli@14 \
63+
&& npm cache clean --force
5064

51-
USER ${USERNAME}
65+
USER $USERNAME
5266

53-
RUN pip3 install ${PACKAGES_PYTHON} --user
67+
RUN pip3 install $PACKAGES_PYTHON --user
5468

5569
# RUN ansible-galaxy install -c -r ${TMP_DIR}/requirements.yml
5670
RUN ansible-galaxy collection install -c -r ${TMP_DIR}/requirements.yml

images/fullstacked/display-chromium

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
$CHROME_BIN --disable-dev-shm-usage --no-sandbox --no-first-run $@

images/fullstacked/xvfb-chromium

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
find_free_servernum() {
4+
i=0
5+
while [ -f /tmp/.X$i-lock ]; do
6+
i=$(($i + 1))
7+
done
8+
echo $i
9+
}
10+
11+
export DISPLAY=":$(find_free_servernum)"
12+
Xvfb "$DISPLAY" -ac -screen 0 "${XVFB_WHD:-1280x720x16}" -nolisten tcp +render &
13+
xvfb_pid=$!
14+
15+
echo "(wrapper:) launching with: $@"
16+
17+
function cleanup {
18+
kill -TERM $xvfb_pid > /dev/null 2>&1
19+
}
20+
21+
trap cleanup EXIT
22+
23+
$CHROME_BIN --disable-dev-shm-usage --no-sandbox --disable-gpu --no-first-run $@
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
find_free_servernum() {
4+
i=0
5+
while [ -f /tmp/.X$i-lock ]; do
6+
i=$(($i + 1))
7+
done
8+
echo $i
9+
}
10+
11+
export DISPLAY=":$(find_free_servernum)"
12+
Xvfb "$DISPLAY" -ac -screen 0 "${XVFB_WHD:-1280x800x16}" -nolisten tcp +render &
13+
xvfb_pid=$!
14+
15+
function cleanup {
16+
kill -TERM $xvfb_pid > /dev/null 2>&1
17+
}
18+
19+
trap cleanup EXIT
20+
21+
$CHROME_BIN --no-sandbox --no-first-run --use-gl=osmesa --enable-webgl --ignore-gpu-blacklist --window-size=1024,768 $@

0 commit comments

Comments
 (0)