-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
90 lines (65 loc) · 2.86 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
#
# 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 idm-console-framework-base
RUN dnf install -y dnf-plugins-core systemd \
&& dnf clean all \
&& rm -rf /var/cache/dnf
CMD [ "/usr/sbin/init" ]
################################################################################
FROM idm-console-framework-base AS idm-console-framework-deps
ARG COPR_REPO
# Enable COPR repo if specified
RUN if [ -n "$COPR_REPO" ]; then dnf copr enable -y $COPR_REPO; fi
# Install IDM Console Framework runtime dependencies
RUN dnf install -y java-17-openjdk-headless \
&& rpm -e --nodeps $(rpm -qa | grep -E "^java-") \
&& dnf clean all \
&& rm -rf /var/cache/dnf
################################################################################
FROM idm-console-framework-deps AS idm-console-framework-builder-deps
# Install build tools
RUN dnf install -y rpm-build
# Import IDM Console Framework sources
COPY idm-console-framework.spec /root/idm-console-framework/
WORKDIR /root/idm-console-framework
# Install IDM Console Framework build dependencies
RUN dnf builddep -y --skip-unavailable --spec idm-console-framework.spec
################################################################################
FROM idm-console-framework-builder-deps AS idm-console-framework-builder
# Import JSS packages
COPY --from=quay.io/dogtagpki/jss-dist:latest /root/RPMS /tmp/RPMS/
# Import LDAP SDK packages
COPY --from=quay.io/dogtagpki/ldapjdk-dist:latest /root/RPMS /tmp/RPMS/
# Install build dependencies
RUN dnf localinstall -y /tmp/RPMS/* \
&& dnf clean all \
&& rm -rf /var/cache/dnf \
&& rm -rf /tmp/RPMS
# Import IDM Console Framework sources
COPY . /root/idm-console-framework/
# Build IDM Console Framework packages
RUN ./build.sh --work-dir=build rpm
################################################################################
FROM alpine:latest AS idm-console-framework-dist
# Import IDM Console Framework packages
COPY --from=idm-console-framework-builder /root/idm-console-framework/build/SRPMS /root/SRPMS/
COPY --from=idm-console-framework-builder /root/idm-console-framework/build/RPMS /root/RPMS/
################################################################################
FROM idm-console-framework-deps AS idm-console-framework-runner
# Import JSS packages
COPY --from=quay.io/dogtagpki/jss-dist:latest /root/RPMS /tmp/RPMS/
# Import LDAP SDK packages
COPY --from=quay.io/dogtagpki/ldapjdk-dist:latest /root/RPMS /tmp/RPMS/
# Import IDM Console Framework packages
COPY --from=idm-console-framework-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