我有一个带有这个 Dockerfile 的工作 UBUNTU 映像:
FROM perl:5.14
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y libgd-dev
RUN perl -MCPAN -e 'install (Try::Tiny)'
RUN perl -MCPAN -e 'install (Kafka::Connection)'
RUN perl -MCPAN -e 'install (YAML)'
RUN perl -MCPAN -e 'install (GD::Simple)'
RUN perl -MCPAN -e 'install (GD::Graph)'
RUN perl -MCPAN -e 'install (JSON)'
RUN perl -MCPAN -e 'install (JSON::MaybeXS)'
RUN perl -MCPAN -e 'install (HTTP::Request)'
RUN perl -MCPAN -e 'install (HTTP::Response)'
RUN perl -MCPAN -e 'install (HTTP::Daemon)'
COPY run.sh /run.sh
RUN chmod +x "/run.sh"
RUN mkdir -p /code_path
WORKDIR /code_path
CMD ["/run.sh"]
我试图得到一个像这样更苗条的高山版本:
FROM alpine:3.10.3
## alpine curl and wget aren't fully compatible, so we install them
## here. gnupg is needed for Module::Signature.
RUN apk update && apk upgrade
RUN apk add curl tar make gcc build-base wget gnupg
RUN mkdir -p /usr/src/perl
WORKDIR /usr/src/perl
## from perl; `true make test_harness` because 3 tests fail
## some flags from http://git.alpinelinux.org/cgit/aports/tree/main/perl/APKBUILD?id=19b23f225d6e4f25330e13144c7bf6c01e624656
RUN curl -SLO https://www.cpan.org/src/5.0/perl-5.30.0.tar.gz \
&& echo 'aa5620fb5a4ca125257ae3f8a7e5d05269388856 *perl-5.30.0.tar.gz' | sha1sum -c - \
&& tar --strip-components=1 -xzf perl-5.30.0.tar.gz -C /usr/src/perl \
&& rm perl-5.30.0.tar.gz \
&& ./Configure -des \
-Duse64bitall \
-Dcccdlflags='-fPIC' \
-Dcccdlflags='-fPIC' \
-Dccdlflags='-rdynamic' \
-Dlocincpth=' ' \
-Duselargefiles \
-Dusethreads \
-Duseshrplib \
-Dd_semctl_semun \
-Dusenm \
&& make libperl.so \
&& make -j$(nproc) \
&& true TEST_JOBS=$(nproc) make test_harness \
&& make install \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
## from tianon/perl
ENV PERL_CPANM_OPT --verbose --mirror https://cpan.metacpan.org --mirror-only
RUN cpanm Digest::SHA Module::Signature && rm -rf ~/.cpanm
ENV PERL_CPANM_OPT $PERL_CPANM_OPT --verify
RUN perl -MCPAN -e 'install (Try::Tiny)'
RUN perl -MCPAN -e 'install (Kafka::Connection)'
RUN perl -MCPAN -e 'install (YAML)'
RUN perl -MCPAN -e 'install (GD::Simple)'
RUN perl -MCPAN -e 'install (GD::Graph)'
RUN perl -MCPAN -e 'install (JSON)'
RUN perl -MCPAN -e 'install (JSON::MaybeXS)'
RUN perl -MCPAN -e 'install (HTTP::Request)'
RUN perl -MCPAN -e 'install (HTTP::Response)'
RUN perl -MCPAN -e 'install (HTTP::Daemon)'
COPY run.sh /run.sh
RUN chmod +x "/run.sh"
RUN mkdir -p /code_path
WORKDIR /code_path
CMD ["/run.sh"]
我不断收到此错误
OS.c:18:10: fatal error: obstack.h: No such file or directory
#include <obstack.h> /* glibc's handy obstacks */
如何获取图像上 Kafka 的所有依赖项?