-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.slave
35 lines (27 loc) · 1.02 KB
/
Dockerfile.slave
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
FROM docker:18.09-rc-dind
LABEL MAINTAINER="Terry Chou <[email protected]>"
ARG USER=jenkins
ARG GROUP=jenkins
ARG UID=10001
ARG GID=10001
ARG JENKINS_AGENT_HOME=/home/${USER}
ENV JENKINS_AGENT_HOME ${JENKINS_AGENT_HOME}
RUN apk update \
&& apk add --no-cache sudo openssh \
&& sed -i /etc/ssh/sshd_config \
-e 's/#PermitRootLogin.*/PermitRootLogin no/' \
-e 's/#RSAAuthentication.*/RSAAuthentication yes/' \
-e 's/#PasswordAuthentication.*/PasswordAuthentication no/' \
-e 's/#SyslogFacility.*/SyslogFacility AUTH/' \
-e 's/#LogLevel.*/LogLevel INFO/' \
&& mkdir /var/run/sshd \
&& echo "%${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
#Update credential for Jenkins user
RUN addgroup -g ${GID} ${GROUP} \
&& adduser -D -h "${JENKINS_AGENT_HOME}" -u "${UID}" -G "${GROUP}" -s /bin/bash "${USER}" \
&& delgroup ping
VOLUME "${JENKINS_AGENT_HOME}" "/tmp" "/run" "/var/run"
WORKDIR "${JENKINS_AGENT_HOME}"
COPY setup /usr/local/bin/setup
EXPOSE 22
ENTRYPOINT ["setup"]