forked from artisantek/java-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (24 loc) · 975 Bytes
/
Dockerfile
File metadata and controls
26 lines (24 loc) · 975 Bytes
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
# Stage 1: Build Jenkins
FROM ubuntu:latest AS jenkins-build
RUN apt-get update && \
apt-get install -y openjdk-8-jdk wget gnupg2 && \
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add - && \
echo "deb https://pkg.jenkins.io/debian-stable binary/" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y jenkins && \
rm -rf /var/lib/apt/lists/*
# Stage 2: Build Apache2
FROM ubuntu:latest AS apache2-build
RUN apt-get update && \
apt-get install -y apache2 && \
rm -rf /var/lib/apt/lists/*
# Stage 3: Create final image with Jenkins and Apache2
FROM ubuntu:latest
COPY --from=jenkins-build /usr/share/jenkins /usr/share/jenkins
COPY --from=apache2-build /usr/sbin/apache2 /usr/sbin/apache2
COPY --from=apache2-build /etc/apache2 /etc/apache2
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
rm -rf /var/lib/apt/lists/*
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
EXPOSE 80