Skip to content

Commit 2107b9c

Browse files
committed
fix[build]: Fixed cpan build commands
1 parent 20ff132 commit 2107b9c

File tree

3 files changed

+81
-67
lines changed

3 files changed

+81
-67
lines changed

Dockerfile-bullseye

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ EOF
4848

4949
FROM perl:5.36.3-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:
5454
RUN <<EOF
@@ -69,17 +69,46 @@ EOF
6969
ENV PERL_CANARY_STABILITY_NOPROMPT=1
7070
RUN <<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/* ~/.[^.] ~/.??* ~/*
8079
EOF
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+
83112
FROM base as base-cpan
84113

85114
RUN <<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/* ~/.[^.] ~/.??* ~/*
126150
EOF
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
#
133157
FROM 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
138162
COPY src/entry.sh src/health-check.sh src/ssh_known_hosts.txt /
@@ -223,6 +247,7 @@ CMD [ "start" ]
223247

224248
FROM with-fhem as with-fhem-extended
225249

250+
ENV PERL5LIB=${PERL5LIB}:/usr/src/app/3rdparty/lib/perl5
226251

227252
# Add extended system layer
228253
RUN <<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/* ~/.[^.] ~/.??* ~/*
255273
EOF
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

Dockerfile-threaded-bullseye

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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

77
ARG TARGETPLATFORM
88

@@ -46,9 +46,9 @@ EOF
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:
5454
RUN <<EOF
@@ -69,17 +69,46 @@ EOF
6969
ENV PERL_CANARY_STABILITY_NOPROMPT=1
7070
RUN <<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/* ~/.[^.] ~/.??* ~/*
8079
EOF
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+
83112
FROM base as base-cpan
84113

85114
RUN <<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/* ~/.[^.] ~/.??* ~/*
126150
EOF
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
#
133157
FROM 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
138162
COPY src/entry.sh src/health-check.sh src/ssh_known_hosts.txt /
@@ -223,6 +247,7 @@ CMD [ "start" ]
223247

224248
FROM with-fhem as with-fhem-extended
225249

250+
ENV PERL5LIB=${PERL5LIB}:/usr/src/app/3rdparty/lib/perl5
226251

227252
# Add extended system layer
228253
RUN <<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/* ~/.[^.] ~/.??* ~/*
255273
EOF
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

scripts/excluded_packages.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,6 @@ DevIo$
5353
AttrTemplate$
5454
ProtoThreads$
5555
# CARP is core, here is something wrong:
56-
carp$
56+
carp$
57+
# Pcakage does not exists (anymore?) on metacpan
58+
JSON::backportPP$

0 commit comments

Comments
 (0)