forked from ValtechMobility/jnlp-agent-jdk17
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
70 lines (53 loc) · 1.95 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
FROM ubuntu:22.04 as fetcher
ENV NVM_VERSION v0.39.5
RUN apt-get update && \
apt-get install -y git && \
git clone \
--depth 1 \
--branch $NVM_VERSION \
https://github.com/nvm-sh/nvm.git
FROM jenkins/inbound-agent:alpine as jnlp
FROM jenkins/agent:latest-jdk17
ARG version
LABEL Description="This is a base image, which allows connecting Jenkins agents via JNLP protocols" Vendor="Jenkins project" Version="$version"
ARG user=jenkins
USER root
COPY --from=jnlp /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-agent
RUN chmod +x /usr/local/bin/jenkins-agent &&\
ln -s /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-slave
# we don't want to store cached files in the image
VOLUME /var/cache/apt
RUN apt-get update \
&& apt-get -y install \
unzip \
curl \
rsync \
openssh-client \
ca-certificates-java \
openjdk-17-jdk \
graphviz \
ca-certificates \
gnupg
#ENV CHROME_BIN=/usr/bin/chromium-browser
RUN apt-get update && apt-get -y install chromium chromium-driver
RUN apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb
# prepare place for binaries symlinks
RUN mkdir -p /home/jenkins/bin && \
chown -R jenkins:jenkins /home/jenkins/bin
ENV PATH="$PATH:/home/jenkins/bin"
ENV NVM_DIR=/opt/nvm
# don't store npm cache in the image
VOLUME ~/.npm
# copy the nvm
COPY --from=fetcher --chown=jenkins:jenkins nvm $NVM_DIR
# copy wrapper scripts
COPY bin /usr/local/bin
USER ${user}
RUN nvm install node
RUN curl -fsSL https://get.pnpm.io/install.sh |ENV="$HOME/.shrc" SHELL="$(which sh)" sh -
ENV PNPM_HOME="/home/jenkins/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN pnpm config set store-dir /home/jenkins/.local/share/pnpm/store
# Cypress 13.6.3 because of bugs >13.6.3 https://github.com/cypress-io/cypress/issues/27501
RUN CYPRESS_INSTALL_BINARY=13.6.3 pnpm install -g [email protected]
ENTRYPOINT ["/usr/local/bin/jenkins-agent"]