Răsfoiți Sursa

prosody: use a 2-stage build

This greatly simplifies the cleanup so we don't leave unneeded packages
behind.
Saúl Ibarra Corretgé 5 ani în urmă
părinte
comite
1d428a8440
1 a modificat fișierele cu 21 adăugiri și 18 ștergeri
  1. 21 18
      prosody/Dockerfile

+ 21 - 18
prosody/Dockerfile

@@ -1,4 +1,22 @@
 ARG JITSI_REPO=jitsi
+
+FROM ${JITSI_REPO}/base as builder
+
+RUN \
+    apt-dpkg-wrap apt-get update \
+    && apt-dpkg-wrap apt-get install -y \
+      lua5.2 \
+      liblua5.2-dev \
+      libsasl2-dev \
+      libssl1.0-dev \
+      luarocks \
+      git \
+      gcc \
+    && luarocks install cyrussasl 1.1.0-1 \
+    && luarocks install lua-cjson 2.1.0-1 \
+    && luarocks install luajwtjitsi 1.3-7 \
+    && luarocks install net-url 0.9-1
+
 FROM ${JITSI_REPO}/base
 
 ADD https://prosody.im/files/prosody-debian-packages.key /tmp/prosody.key
@@ -14,28 +32,10 @@ RUN \
       sasl2-bin \
       libsasl2-modules-ldap \
       lua-basexx \
-      liblua5.2-dev \
-      libsasl2-dev \
-      libssl1.0-dev \
-      luarocks \
-      git \
-      gcc \
       patch \
     && apt-dpkg-wrap apt-get install -t stretch-backports -y \
       lua-ldap \
       lua-sec \
-    && luarocks install cyrussasl 1.1.0-1 \
-    && luarocks install lua-cjson 2.1.0-1 \
-    && luarocks install luajwtjitsi 1.3-7 \
-    && luarocks install net-url 0.9-1 \
-    && apt-dpkg-wrap apt-get remove --purge -y \
-      git \
-      gcc \
-      luarocks \
-      libsasl2-dev \
-      libssl1.0-dev \
-      liblua5.2-dev \
-    && apt-dpkg-wrap apt-get autoremove --purge -y \
     && apt-cleanup \
     && rm -rf /etc/prosody
 
@@ -51,6 +51,9 @@ RUN patch -d /usr/lib/prosody/modules/muc -p0 < /prosody-plugins/muc_owner_allow
 
 COPY rootfs/ /
 
+COPY --from=builder /usr/local/lib/lua /usr/local/lib/lua
+COPY --from=builder /usr/local/share/lua /usr/local/share/lua
+
 EXPOSE 5222 5269 5347 5280
 
 VOLUME ["/config", "/prosody-plugins-custom"]