-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
124 lines (99 loc) · 3.11 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Pull base image
FROM jenkins:latest
LABEL maintainer="Sergiy Slobodyanyk <nedved198725@gmail.com>"
USER root
# Add user to group
ARG USER=sergiys
ARG UID=1001
ARG GID=1002
# Update and upgrade all packages
RUN \
rm docker-java-home && \
apt-get autoremove -y python && \
apt-get update -y && \
apt-get -y upgrade
# Update python
RUN \
#apt-get autoremove -y python && \
apt-get install -y python3
# Install main packages, fonts, dependencies
RUN apt-get install -y openjdk-8-jdk \
maven \
git \
xvfb \
libappindicator1 \
libappindicator3-1 \
libindicator7 \
fonts-liberation \
xdg-utils \
libxss1 \
libnss3 \
libxpm4 \
libxrender1 \
libgtk2.0-0 \
libgconf-2-4 \
gtk2-engines-pixbuf \
xfonts-cyrillic \
xfonts-100dpi \
xfonts-75dpi \
xfonts-base \
xfonts-scalable
ENV DISPLAY=:99
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
ENV JAVA_VERSION=8u252
ENV JAVA_DEBIAN_VERSION=8u252-b09-1~18.04-b09
ENV CA_CERTIFICATES_JAVA_VERSION=20190931+nmu1
ENV GIT_HOME=/usr/bin/git
ENV MAVEN_HOME=/usr/share/maven
ENV XVFB=/usr/bin
RUN /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1600x1200x24
# Install Google Chrome
RUN \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
dpkg -i google-chrome*.deb && \
apt --fix-broken install && \
rm google-chrome-stable_current_amd64.deb
ENV GOOGLE-CHROME=/usr/bin/google-chrome
# Update jenkins
RUN \
wget https://updates.jenkins-ci.org/latest/jenkins.war && \
mv jenkins.war /usr/share/jenkins/
ENV JENKINS_HOME=/var/jenkins_home
ENV JENKINS_VERSION=2.211
ENV JENKINS_SLAVE_AGENT_PORT=50000
# Install Allure commandline
RUN \
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.13.5/allure-commandline-2.13.5.zip && \
unzip allure-commandline-2.13.5.zip && \
mv allure-2.13.5 /usr/bin/allure-2.13.5 && \
rm allure-commandline-2.13.5.zip && \
apt-get clean
ENV ALLURE_COMMAND_LINE=/usr/bin/allure-2.13.5
# Let's start with some basic stuff.
#RUN apt-get update -qq && apt-get install -qqy \
# apt-transport-https \
# ca-certificates \
# curl \
# lxc \
# iptables
# Install Docker from Docker Inc. repositories.
#RUN curl -sSL https://get.docker.com/ | sh
# Using unencrypted password/ specifying password
#RUN useradd -m ${USER} --uid=${UID} && echo "${USER}:${PW}" | chpasswd
# Setup default user, when enter docker container
RUN groupadd --system ${GID}
RUN useradd -s /sbin/nologin --system -u ${UID} ${USER}
RUN id ${USER}
WORKDIR /home/${USER}
RUN chown -R ${UID}:${UID} /home/${USER}
#RUN usermod -aG docker root
# Define volume directory
VOLUME ["/var/jenkins_home"]
VOLUME ["/home/${USER}/Downloads/"]
#VOLUME ["/var/lib/docker"]
# Define working directory
WORKDIR /var/jenkins_home
EXPOSE 34579 50000 465
USER ${USER}