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