forked from inspircd/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (45 loc) · 1.87 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
FROM alpine:3.11 as builder
LABEL maintainer1="Adam <[email protected]>" \
maintainer2="Sheogorath <[email protected]>"
ARG VERSION=insp3
ARG CONFIGUREARGS=
ARG EXTRASMODULES=
ARG BUILD_DEPENDENCIES=
# Stage 0: Build from source
COPY modules/ /src/modules/
RUN apk add --no-cache gcc g++ make git pkgconfig perl \
perl-net-ssleay perl-crypt-ssleay perl-lwp-protocol-https \
perl-libwww wget gnutls-dev $BUILD_DEPENDENCIES
RUN addgroup -g 10000 -S inspircd
RUN adduser -u 10000 -h /inspircd/ -D -S -G inspircd inspircd
RUN git clone https://github.com/inspircd/inspircd.git inspircd-src
WORKDIR /inspircd-src
RUN git checkout $(git describe --abbrev=0 --tags $VERSION)
## Add modules
RUN { [ $(ls /src/modules/ | wc -l) -gt 0 ] && cp -r /src/modules/* /inspircd-src/src/modules/ || echo "No modules overwritten/added by repository"; }
RUN echo $EXTRASMODULES | xargs --no-run-if-empty ./modulemanager install
RUN ./configure --prefix /inspircd --uid 10000 --gid 10000
RUN echo $CONFIGUREARGS | xargs --no-run-if-empty ./configure
RUN make -j`getconf _NPROCESSORS_ONLN` install
## Wipe out vanilla config; entrypoint.sh will handle repopulating it at runtime
RUN rm -rf /inspircd/conf/*
# Stage 1: Create optimized runtime container
FROM alpine:3.11
ARG RUN_DEPENDENCIES=
RUN apk add --no-cache libgcc libstdc++ gnutls gnutls-utils $RUN_DEPENDENCIES && \
addgroup -g 10000 -S inspircd && \
adduser -u 10000 -h /inspircd/ -D -S -G inspircd inspircd
COPY --chown=inspircd:inspircd conf/ /conf/
COPY --chown=inspircd:inspircd entrypoint.sh /entrypoint.sh
COPY --from=builder --chown=inspircd:inspircd /inspircd/ /inspircd/
USER inspircd
EXPOSE 6667 6697 7000 7001
WORKDIR /
ENTRYPOINT ["/entrypoint.sh"]
HEALTHCHECK \
--interval=1s \
--timeout=3s \
--start-period=60s \
--retries=3 \
CMD \
/usr/bin/nc -z localhost 6667