liferoad commented on code in PR #29001: URL: https://github.com/apache/beam/pull/29001#discussion_r1375155472
########## sdks/python/container/Dockerfile: ########## @@ -82,6 +82,72 @@ RUN \ # Remove pip cache. rm -rf /root/.cache/pip +# extract the deb packages +# RUN cd /tmp && \ +# # Install native bindings required for dependencies. +# apt-get update && \ +# apt-get download \ +# # Required by python-snappy +# libsnappy-dev \ +# # Required by pyyaml (for c bindings) +# libyaml-dev \ +# # This is used to speed up the re-installation of the sdk. +# ccache \ +# # Required for using Beam Python SDK on ARM machines. +# libgeos-dev \ +# && \ +# mkdir /dpkg && \ +# for deb in *.deb; do dpkg -i $deb; dpkg --extract $deb /dpkg || exit 10; done + +FROM gcr.io/distroless/cc-debian12 as beam +LABEL Author "Apache Beam <d...@beam.apache.org>" +ARG TARGETOS +ARG TARGETARCH + +# copy some commands +COPY --from=python-base /bin /bin + +# ARG CHIPSET_ARCH=x86_64-linux-gnu +# arm +# ARG CHIPSET_ARCH=aarch64-linux-gnu + +# copy python to distroless +COPY --from=python-base /usr/local/lib/ /usr/local/lib/ +COPY --from=python-base /usr/local/bin/python /usr/local/bin/python +COPY --from=python-base /usr/local/bin/pip /usr/local/bin/pip Review Comment: I polished the file now. We copy our installed packages to distroless. It should be stable. ########## sdks/python/container/Dockerfile: ########## @@ -82,6 +82,72 @@ RUN \ # Remove pip cache. rm -rf /root/.cache/pip +# extract the deb packages +# RUN cd /tmp && \ +# # Install native bindings required for dependencies. +# apt-get update && \ +# apt-get download \ +# # Required by python-snappy +# libsnappy-dev \ +# # Required by pyyaml (for c bindings) +# libyaml-dev \ +# # This is used to speed up the re-installation of the sdk. +# ccache \ +# # Required for using Beam Python SDK on ARM machines. +# libgeos-dev \ +# && \ +# mkdir /dpkg && \ +# for deb in *.deb; do dpkg -i $deb; dpkg --extract $deb /dpkg || exit 10; done + +FROM gcr.io/distroless/cc-debian12 as beam +LABEL Author "Apache Beam <d...@beam.apache.org>" +ARG TARGETOS +ARG TARGETARCH + +# copy some commands +COPY --from=python-base /bin /bin + +# ARG CHIPSET_ARCH=x86_64-linux-gnu +# arm +# ARG CHIPSET_ARCH=aarch64-linux-gnu + +# copy python to distroless +COPY --from=python-base /usr/local/lib/ /usr/local/lib/ +COPY --from=python-base /usr/local/bin/python /usr/local/bin/python +COPY --from=python-base /usr/local/bin/pip /usr/local/bin/pip +COPY --from=python-base /etc/ld.so.cache /etc/ld.so.cache +COPY --from=python-base /usr/local/gcloud /usr/local/gcloud + + +# copy venv +COPY --from=python-base /venv-beam /venv-beam +ENV PATH="/venv-beam/bin:$PATH" + +# required by lots of packages - e.g. six, numpy, wsgi +COPY --from=python-base /lib /lib + +# COPY --from=python-base /lib/${CHIPSET_ARCH} /lib/${CHIPSET_ARCH} + +# COPY --from=python-base /lib/${CHIPSET_ARCH}/libz* /lib/${CHIPSET_ARCH}/ +# COPY --from=python-base /lib/${CHIPSET_ARCH}/libselinux* /lib/${CHIPSET_ARCH}/ +# # required by google-cloud/grpcio +# COPY --from=python-base /usr/lib/${CHIPSET_ARCH}/libffi* /usr/lib/${CHIPSET_ARCH}/ +# COPY --from=python-base /lib/${CHIPSET_ARCH}/libexpat* /lib/${CHIPSET_ARCH}/ + +# quick validation that python works +RUN python --version Review Comment: Removed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org