forked from dogtagpki/tomcatjss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
83 lines (60 loc) · 2.27 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
#
# Copyright Red Hat, Inc.
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
ARG BASE_IMAGE="registry.fedoraproject.org/fedora:latest"
ARG COPR_REPO=""
################################################################################
FROM $BASE_IMAGE AS tomcatjss-base
RUN dnf install -y dnf-plugins-core systemd \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/sbin/init" ]
################################################################################
FROM tomcatjss-base AS tomcatjss-deps
ARG COPR_REPO
# Enable COPR repo if specified
RUN if [ -n "$COPR_REPO" ]; then dnf copr enable -y $COPR_REPO; fi
# Install Tomcat JSS runtime dependencies
RUN dnf install -y dogtag-tomcatjss \
&& dnf remove -y dogtag-* --noautoremove \
&& dnf clean all \
&& rm -rf /var/cache/dnf
################################################################################
FROM tomcatjss-deps AS tomcatjss-builder-deps
# Install build tools
RUN dnf install -y rpm-build
# Import Tomcat JSS sources
COPY tomcatjss.spec /root/tomcatjss/
WORKDIR /root/tomcatjss
# Install Tomcat JSS build dependencies
RUN dnf builddep -y --skip-unavailable --spec tomcatjss.spec
################################################################################
FROM tomcatjss-builder-deps AS tomcatjss-builder
# Import JSS packages
COPY --from=quay.io/dogtagpki/jss-dist:latest /root/RPMS /tmp/RPMS/
# Install build depencencies
RUN dnf localinstall -y /tmp/RPMS/* \
&& dnf clean all \
&& rm -rf /var/cache/dnf \
&& rm -rf /tmp/RPMS
# Import Tomcat JSS source
COPY . /root/tomcatjss/
# Build Tomcat JSS packages
RUN ./build.sh --work-dir=build rpm
################################################################################
FROM alpine:latest AS tomcatjss-dist
# Import Tomcat JSS packages
COPY --from=tomcatjss-builder /root/tomcatjss/build/RPMS /root/RPMS/
################################################################################
FROM tomcatjss-deps AS tomcatjss-runner
# Import JSS packages
COPY --from=quay.io/dogtagpki/jss-dist:latest /root/RPMS /tmp/RPMS/
# Import Tomcat JSS packages
COPY --from=tomcatjss-dist /root/RPMS /tmp/RPMS/
# Install runtime packages
RUN dnf localinstall -y /tmp/RPMS/* \
&& dnf clean all \
&& rm -rf /var/cache/dnf \
&& rm -rf /tmp/RPMS