-
Notifications
You must be signed in to change notification settings - Fork 0
/
Containerfile
92 lines (64 loc) · 2.17 KB
/
Containerfile
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
ARG PROSODY_VERSION=0.12.4
ARG LUA_VERSION=5.4
ARG BASE_IMAGE=debian:bookworm-slim
ARG USERID=5222
ARG GROUPID=${USERID}
###############################################################################
# Base image
FROM ${BASE_IMAGE} as base
ARG LUA_VERSION
RUN apt-get update
# prosody lua dependencies
RUN apt-get install -y lua-unbound lua${LUA_VERSION} lua-event lua-readline lua-sql-sqlite3 lua-dbi-sqlite3 lua-socket lua-sec lua-expat lua-filesystem luarocks \
&& apt-get install -y liblua${LUA_VERSION}-dev libidn11-dev libssl-dev libicu-dev \
&& rm -rf /var/lib/apt/lists/*
###############################################################################
# Build image
FROM base as builder
ARG PROSODY_VERSION
ARG LUA_VERSION
# add tooling required for build
RUN apt-get update \
&& apt-get install -y mercurial build-essential bsdmainutils \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /build
RUN hg clone https://hg.prosody.im/trunk -r ${PROSODY_VERSION} /build/prosody-hg
WORKDIR /build/prosody-hg
RUN ./configure \
--idn-library=icu \
--prefix=/opt/prosody \
--libdir=/opt/prosody/lib \
--sysconfdir=/etc/prosody \
--datadir=/var/lib/prosody \
--lua-version=${LUA_VERSION} \
--no-example-certs
RUN make
RUN make install
# preserve symbolic links
RUN tar -cf /build/install.tar /opt/ /etc/prosody/ /var/lib/prosody
###############################################################################
# Application image
FROM base
ARG USERID
ARG GROUPID
ENV PATH=/opt/prosody/bin:$PATH
COPY rootfs/ /
COPY --from=builder /build/install.tar /build/
RUN tar -xf /build/install.tar -C / \
&& rm -rf /build \
&& groupadd -g ${GROUPID} prosody \
&& useradd -u ${USERID} -d /opt/prosody --system -g ${GROUPID} prosody \
&& mkdir -p /usr/lib/prosody/enabled-modules/ \
&& mkdir -p /var/lib/prosody/custom_plugins \
&& chown -R prosody:prosody \
/var/lib/prosody \
/usr/lib/prosody/enabled-modules/ \
/var/lib/prosody/custom_plugins
VOLUME [ "/var/lib/prosody", "/etc/prosody" ]
USER prosody
WORKDIR /opt/prosody
EXPOSE 5000/tcp
EXPOSE 5222/tcp
EXPOSE 5281/tcp
ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "prosody", "-F" ]