22#
33# base layer with perl and some general preparations
44#
5- FROM perl:5.36.3-slim-threaded-buster as base
5+ FROM perl:5.36.3-slim-threaded-bullseye as base
66
77ARG TARGETPLATFORM
88
4646# Install all CPAN Modules, needed from FHEM and standard modules
4747#
4848
49- FROM perl:5.36.3-threaded-buster as build-cpan
49+ FROM perl:5.36.3-threaded-bullseye as build-cpan
5050
51- COPY cpanfile /usr/src/app/core- cpanfile
51+ COPY cpanfile /usr/src/app/core/ cpanfile
5252
5353# Install Packages used for building cpan modules:
5454RUN <<EOF
6969ENV PERL_CANARY_STABILITY_NOPROMPT=1
7070RUN <<EOF
7171 if [ "${TARGETPLATFORM}" != "linux/amd64" ] && [ "${TARGETPLATFORM}" != "linux/i386" ]; then
72- sed -i '/Device::Firmata::Constants/d' /usr/src/app/core- cpanfile
72+ sed -i '/Device::Firmata::Constants/d' /usr/src/app/core/ cpanfile
7373 fi
7474
75- cpm install --without-test --with-suggests --with-recommends --cpanfile /usr/src/app/core-cpanfile --show-build-log-on-failure --configure-timeout=360 --workers=$(nproc)
76-
75+ cpm install --without-test --with-suggests --with-recommends --cpanfile /usr/src/app/core/cpanfile --show-build-log-on-failure --configure-timeout=360 --workers=$(nproc) --local-lib-contained core/
7776 rm -rf /root/.cpanm
7877 rm -rf /root/.perl-cpm/
7978 rm -rf /tmp/* /var/tmp/* ~/.[^.] ~/.??* ~/*
8079EOF
8180
8281
82+ # Install Packages used for building 3rdparty cpan modules:
83+ RUN <<EOF
84+ LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get update
85+ LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends \
86+ libsox-fmt-all \
87+ libbluetooth-dev \
88+ libi2c-dev \
89+ libgd-dev \
90+ libdbus-1-dev \
91+ libimlib2-dev \
92+ libsodium-dev
93+ LC_ALL=C apt-get autoremove -qqy && LC_ALL=C apt-get clean
94+ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.[^.] ~/.??* ~/*
95+ EOF
96+
97+
98+ # Install all CPAN Modules, needed from 3rd party module repositorys
99+ COPY 3rdParty/cpanfile /usr/src/app/3rdparty/cpanfile
100+ # Fixup modules which do not work on all platforms and install afterwards
101+ RUN <<EOF
102+ if [ "${TARGETPLATFORM}" != "linux/amd64" ] && [ "${TARGETPLATFORM}" != "linux/i386" ]; then
103+ sed -i '/Device::Firmata::Constants/d' /usr/src/app/3rdparty/cpanfile
104+ fi
105+
106+ cpm install --cpanfile /usr/src/app/3rdparty/cpanfile --without-test --with-recommends --with-suggests --show-build-log-on-failure --configure-timeout=360 --workers=$(nproc) --local-lib-contained 3rdparty/
107+ rm -rf /root/.cpanm
108+ rm -rf /root/.perl-cpm
109+ EOF
110+
111+
83112FROM base as base-cpan
84113
85114RUN <<EOF
@@ -114,25 +143,20 @@ RUN <<EOF
114143 usbutils \
115144 wget \
116145 libarchive-dev \
117- libimlib2-dev \
118146 bash \
119147 iproute2
120- # Install Packages used for building cpan modules:
121- LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends \
122- libusb-dev \
123- python3-dev
124148 LC_ALL=C apt-get autoremove -qqy && LC_ALL=C apt-get clean
125149 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.[^.] ~/.??* ~/*
126150EOF
127151
128- COPY --from=build-cpan /usr/src/app/local /lib/perl5 /usr/src/app/local /lib/perl5
152+ COPY --from=build-cpan /usr/src/app/core /lib/perl5 /usr/src/app/core /lib/perl5
129153
130154#
131155# Standard FHEM Layer
132156#
133157FROM base-cpan as with-fhem
134158
135- ENV PERL5LIB=/usr/src/app/local /lib/perl5
159+ ENV PERL5LIB=/usr/src/app/core /lib/perl5
136160
137161# Install base environment and FHEM Docker module
138162COPY src/entry.sh src/health-check.sh src/ssh_known_hosts.txt /
@@ -223,6 +247,7 @@ CMD [ "start" ]
223247
224248FROM with-fhem as with-fhem-extended
225249
250+ ENV PERL5LIB=${PERL5LIB}:/usr/src/app/3rdparty/lib/perl5
226251
227252# Add extended system layer
228253RUN <<EOF
@@ -237,36 +262,17 @@ RUN <<EOF
237262 mp3wrap \
238263 mpg123 \
239264 mplayer \
240- nmap \
241265 normalize-audio \
242266 snmp \
243267 snmp-mibs-downloader \
244268 sox \
245269 vorbis-tools \
246- gstreamer1.0-tools \
247- libsox-fmt-all \
248- libbluetooth-dev \
249- libi2c-dev \
250- libgd-dev \
251- libdbus-1-dev
252- libsodium-dev
270+ gstreamer1.0-tools
253271 LC_ALL=C apt-get autoremove -qqy && LC_ALL=C apt-get clean
254272 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.[^.] ~/.??* ~/*
255273EOF
256274
257- # Install all CPAN Modules, needed from 3rd party module repositorys
258- COPY 3rdParty/cpanfile /usr/src/app/3rdparty-cpanfile
259- # Fixup modules which do not work on all platforms and install afterwards
260- RUN <<EOF
261- if [ "${TARGETPLATFORM}" != "linux/amd64" ] && [ "${TARGETPLATFORM}" != "linux/i386" ]; then
262- sed -i '/Device::Firmata::Constants/d' /usr/src/app/3rdparty-cpanfile
263- fi
264-
265- cpm install --cpanfile /usr/src/app/3rdparty-cpanfile --without-test --with-recommends --with-suggests --show-build-log-on-failure --configure-timeout=360 --workers=$(nproc)
266- rm -rf /root/.cpanm
267- rm -rf /root/.perl-cpm
268- EOF
269-
275+ COPY --from=build-cpan /usr/src/app/3rdparty/lib/perl5 /usr/src/app/3rdparty/lib/perl5
270276
271277#
272278# Add additional Python layer
0 commit comments