-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (33 loc) · 1.01 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
FROM hnc-base:latest
LABEL name="hnc-jenkins-agent"
LABEL description="HashNet Container for a Jenkins CI Agent (slave)"
LABEL maintainer="hashsploit <hashsploit@protonmail.com>"
ARG PASSWORD=password
ENV PASSWORD $PASSWORD
# Install dependencies
RUN echo "Updating system ..." \
&& apt-get update >/dev/null 2>&1 \
&& echo "Installing dependencies ..." \
&& apt-get install -y \
git \
openssh-server \
openjdk-11-jdk \
maven \
>/dev/null 2>&1
# Setup SSH server
RUN echo "Setting up SSH server ..." \
&& sed -i 's|session required pam_loginuid.so|session optional pam_loginuid.so|g' /etc/pam.d/sshd && \
&& mkdir -p /var/run/sshd \
>/dev/null 2>&1
# Add jenkins user
RUN adduser --quiet jenkins \
&& echo "jenkins:$PASSWORD" | chpasswd \
&& mkdir -p /home/jenkins/.m2
# Copy authorized keys
COPY .ssh/authorized_keys /home/jenkins/.ssh/
# Set up permissions
RUN chown -R jenkins:jenkins /home/jenkins/
# Expose ssh service
EXPOSE 22
# Set image starting point
CMD ["/usr/sbin/sshd", "-D"]