-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
137 lines (113 loc) · 2.88 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
125
126
127
128
129
130
131
132
133
134
135
136
137
FROM alpine:3.20 as alpine-upgrader
RUN apk upgrade --no-cache
FROM scratch as alpine-upgraded
COPY --from=alpine-upgrader / /
CMD ["/bin/sh"]
FROM alpine-upgraded as build-stage
ARG VERSION=2.4.5
RUN apk add --no-cache \
autoconf \
automake \
build-base \
bzip2-dev \
cargo \
clang16 \
compiler-rt \
cracklib-dev \
cyrus-sasl-dev \
db-dev \
icu-dev \
json-c-dev \
krb5-dev \
libatomic \
libtool \
linux-pam-dev \
lld \
lmdb-dev \
net-snmp-dev \
nspr-dev \
nss-dev \
openldap-dev \
openssl-dev \
pcre2-dev \
python3 \
python3-dev \
py3-argcomplete \
py3-cryptography \
py3-dateutil \
py3-pip \
py3-pyldap \
py3-setuptools \
rust
RUN pip3 install --break-system-packages \
argparse_manpage \
pyasn1 \
pyasn1-modules
RUN mkdir /build
WORKDIR /build
RUN wget https://github.com/389ds/389-ds-base/archive/refs/tags/389-ds-base-${VERSION}.tar.gz && \
tar xzvf 389-ds-base-${VERSION}.tar.gz
COPY remove_execinfo.patch /build
RUN cd 389-ds-base-389-ds-base-${VERSION} && \
patch -p 1 -i ../remove_execinfo.patch
RUN cd 389-ds-base-389-ds-base-${VERSION} && \
autoreconf -fiv && \
./configure \
--build=x86_64-pc-linux-musl \
--host=x86_64-pc-linux-musl \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-clang \
--disable-cockpit \
--disable-dependency-tracking \
--with-openldap \
--with-pythonexec=python3 \
--without-selinux \
--without-systemd
RUN cd 389-ds-base-389-ds-base-${VERSION} && \
make && \
make lib389 && \
make check && \
DESTDIR=/out make install && \
cd src/lib389 && \
python3 setup.py install --skip-build --root=/out
RUN rm -rf /out/[email protected]
CMD ["/bin/sh"]
FROM alpine-upgraded
RUN apk add --no-cache \
ca-certificates \
cracklib \
db \
icu-libs \
json-c \
krb5 \
libgcc \
libldap \
linux-pam \
lmdb \
net-snmp-libs \
net-snmp-agent-libs \
nspr \
nss-tools \
openldap-clients \
openssl \
pcre2 \
python3
RUN adduser -D -h /var/run/dirsrv dirsrv
COPY --from=build-stage /usr/lib/python3.12/site-packages/ /usr/lib/python3.12/site-packages/
COPY --from=build-stage /out /
RUN mkdir -p /data/config && \
mkdir -p /data/ssca && \
mkdir -p /data/run && \
chown dirsrv:dirsrv /data/config && \
chown dirsrv:dirsrv /data/ssca && \
chown dirsrv:dirsrv /data/run && \
ln -s /data/config /etc/dirsrv/slapd-localhost && \
ln -s /data/ssca /etc/dirsrv/ssca && \
ln -s /data/run /var/run/dirsrv
VOLUME /data
EXPOSE 3389 3636
# USER dirsrv
CMD [ "/usr/libexec/dirsrv/dscontainer", "-r" ]
HEALTHCHECK --start-period=5m --timeout=5s --interval=5s --retries=2 CMD /usr/libexec/dirsrv/dscontainer -H