-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathDockerfile
More file actions
138 lines (113 loc) · 4.83 KB
/
Copy pathDockerfile
File metadata and controls
138 lines (113 loc) · 4.83 KB
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
138
# Multi-stage build for ircu2 test harness
#
# Targets:
# runtime-tree — build from the working tree (default; last stage)
# runtime-release — download and build a tagged UndernetIRC/ircu2 release
# (used as the "prod" peer in NETWORK_FEATURES compat tests)
ARG TLS_BACKEND=openssl
ARG SANITIZE=
ARG IRCD_RELEASE_TAG=u2.10.12.19
# ---------------------------------------------------------------------------
# Stage: build from the current working tree
# ---------------------------------------------------------------------------
FROM debian:trixie-slim AS builder-tree
ARG TLS_BACKEND=openssl
ARG SANITIZE=
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
make \
bison \
flex \
autoconf \
automake \
autoconf-archive \
libc6-dev \
pkg-config \
$(if [ "$TLS_BACKEND" = "openssl" ]; then echo libssl-dev; \
elif [ "$TLS_BACKEND" = "gnutls" ]; then echo libgnutls28-dev; \
elif [ "$TLS_BACKEND" = "libtls" ]; then echo libtls-dev; fi) \
$(if [ -n "$SANITIZE" ]; then echo libasan8; fi) \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build/ircu2
COPY . .
# Remove any host-compiled binaries (e.g., macOS Mach-O) so make rebuilds for Linux
RUN find . -name '*.o' -delete && rm -f ircd/ircd
RUN ./autogen.sh \
&& if [ -n "$SANITIZE" ]; then \
export CFLAGS="-fsanitize=$SANITIZE -fno-omit-frame-pointer -g -O1"; \
export LDFLAGS="-fsanitize=$SANITIZE"; \
fi; \
./configure --prefix=/opt/ircu --with-maxcon=256 --enable-debug --with-tls=${TLS_BACKEND} \
&& make
# ---------------------------------------------------------------------------
# Stage: build the current Undernet production release from GitHub
# https://github.com/UndernetIRC/ircu2/releases
# ---------------------------------------------------------------------------
FROM debian:trixie-slim AS builder-release
ARG IRCD_RELEASE_TAG=u2.10.12.19
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
make \
bison \
flex \
libc6-dev \
ca-certificates \
curl \
autotools-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build/src
RUN curl -fsSL \
"https://github.com/UndernetIRC/ircu2/releases/download/${IRCD_RELEASE_TAG}/irc${IRCD_RELEASE_TAG}.tar.gz" \
| tar xz --strip-components=1 \
# The 2005-era config.guess/config.sub in the release tarball predate aarch64
&& cp /usr/share/misc/config.guess /usr/share/misc/config.sub . \
&& ./configure --prefix=/opt/ircu --with-maxcon=256 --enable-debug \
&& make \
&& cp ircd/ircd /build/ircd
# ---------------------------------------------------------------------------
# Shared runtime base (no ircd binary yet)
# ---------------------------------------------------------------------------
FROM debian:trixie-slim AS runtime-base
ARG TLS_BACKEND=openssl
ARG SANITIZE=
RUN apt-get update && apt-get install -y --no-install-recommends \
perl \
gdb \
valgrind \
$(if [ "$TLS_BACKEND" = "openssl" ]; then echo libssl3t64; \
elif [ "$TLS_BACKEND" = "gnutls" ]; then echo libgnutls30t64; \
elif [ "$TLS_BACKEND" = "libtls" ]; then echo libtls28t64; fi) \
$(if [ -n "$SANITIZE" ]; then echo libasan8; fi) \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -r -m -d /opt/ircu ircu \
&& mkdir -p /opt/ircu/lib /opt/ircu/bin \
&& chown -R ircu:ircu /opt/ircu
ARG IRCD_CONF=tests/docker/ircd-hub.conf
COPY ${IRCD_CONF} /opt/ircu/lib/ircd.conf
RUN chown ircu:ircu /opt/ircu/lib/ircd.conf
COPY tests/docker/certs /opt/ircu/lib/certs
RUN chown -R ircu:ircu /opt/ircu/lib/certs
# IAuth stub used by the DNS resolver tests (harmless for other configs)
COPY tests/docker/iauth-dns-stub.pl /opt/ircu/lib/iauth-dns-stub.pl
RUN chown ircu:ircu /opt/ircu/lib/iauth-dns-stub.pl
# Create empty motd file
RUN touch /opt/ircu/lib/ircd.motd && chown ircu:ircu /opt/ircu/lib/ircd.motd
COPY tests/docker/iauth-tilded.pl /opt/ircu/bin/iauth-tilded.pl
RUN chmod +x /opt/ircu/bin/iauth-tilded.pl && chown ircu:ircu /opt/ircu/bin/iauth-tilded.pl
COPY tests/docker/ircd-entrypoint.sh /opt/ircu/lib/ircd-entrypoint.sh
RUN chmod 755 /opt/ircu/lib/ircd-entrypoint.sh
WORKDIR /opt/ircu
ENTRYPOINT ["/opt/ircu/lib/ircd-entrypoint.sh"]
CMD ["-f", "/opt/ircu/lib/ircd.conf", "-n"]
# ---------------------------------------------------------------------------
# Final: production release binary (NETWORK_FEATURES compat peer "A")
# ---------------------------------------------------------------------------
FROM runtime-base AS runtime-release
COPY --from=builder-release /build/ircd /opt/ircu/bin/ircd
RUN chown ircu:ircu /opt/ircu/bin/ircd
# ---------------------------------------------------------------------------
# Final: working-tree binary (default target — must stay last)
# ---------------------------------------------------------------------------
FROM runtime-base AS runtime-tree
COPY --from=builder-tree /build/ircu2/ircd/ircd /opt/ircu/bin/ircd
RUN chown ircu:ircu /opt/ircu/bin/ircd