-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (35 loc) · 1.77 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
# syntax=docker/dockerfile:labs
FROM alpine:3.20.3
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
ARG MAVEN_VERSION=3.9.9
ARG MAVEN4_VERSION=4.0.0-rc-1
RUN wget -q https://apk.corretto.aws/amazoncorretto.rsa.pub -O /etc/apk/keys/amazoncorretto.rsa.pub && \
echo "https://apk.corretto.aws" | tee -a /etc/apk/repositories && \
apk upgrade --no-cache -a && \
apk add --no-cache ca-certificates tzdata tini shadow openssl \
git git-lfs \
netcat-openbsd \
openssh-server \
amazon-corretto-8 \
amazon-corretto-11 \
amazon-corretto-17 \
amazon-corretto-21 && \
mkdir -vp /tmp/jdk/bin /tmp/etc/ssh && \
rm -vrf /usr/bin/java && \
ln -s /usr/lib/jvm/java-21-amazon-corretto/bin/java /usr/bin/java && \
ln -s /usr/lib/jvm/java-21-amazon-corretto/bin/java /tmp/jdk/bin/java && \
wget -q https://dlcdn.apache.org/maven/maven-3/"$MAVEN_VERSION"/binaries/apache-maven-"$MAVEN_VERSION"-bin.tar.gz -O - | tar xz -C /usr/local/bin && \
mv /usr/local/bin/apache-maven-"$MAVEN_VERSION" /usr/local/bin/mvn && \
wget -q https://dlcdn.apache.org/maven/maven-4/"$MAVEN4_VERSION"/binaries/apache-maven-"$MAVEN4_VERSION"-bin.tar.gz -O - | tar xz -C /usr/local/bin && \
mv /usr/local/bin/apache-maven-"$MAVEN4_VERSION" /usr/local/bin/mvn4 && \
useradd -d /tmp -Ms /bin/ash -u 1000 jenkins && \
echo "jenkins:$(openssl rand -base64 12)" | chpasswd && \
apk del --no-cache shadow openssl && \
chown -R 1000:1000 /tmp
COPY start.sh /usr/local/bin/start.sh
COPY sshd_config /tmp/sshd_config
USER jenkins
WORKDIR /tmp
ENTRYPOINT ["tini", "--", "start.sh"]
HEALTHCHECK CMD nc -z localhost 2222 || exit 1
EXPOSE 2222/tcp