-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile.haizaar-minimal
29 lines (23 loc) · 1 KB
/
Dockerfile.haizaar-minimal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# This dockerfile was licensed under Apache 2.0 License (see LICENSE-haizaar)
# Source: https://github.com/haizaar/docker-python-minimal
FROM python:alpine as builder
RUN apk add --no-cache binutils
RUN find /usr/local -name '*.so' | xargs strip -s
RUN pip uninstall -y pip
RUN set -ex && \
cd /usr/local/lib/python*/config-*-x86_64-linux-musl/ && \
rm -rf *.o *.a
RUN rm -rf /usr/local/lib/python*/ensurepip
RUN rm -rf /usr/local/lib/python*/idlelib
RUN rm -rf /usr/local/lib/python*/distutils/command
RUN rm -rf /usr/local/lib/python*/lib2to3
RUN rm -rf /usr/local/lib/python*/__pycache__/*
RUN find /usr/local/include/python* -not -name pyconfig.h -type f -exec rm {} \;
RUN find /usr/local/bin -not -name 'python*' \( -type f -o -type l \) -exec rm {} \;
RUN rm -rf /usr/local/share/*
RUN apk del binutils
FROM alpine:latest as final
ENV LANG C.UTF-8
RUN apk add --no-cache libbz2 expat libffi xz-libs sqlite-libs readline ca-certificates
COPY --from=builder /usr/local/ /usr/local/
ENTRYPOINT ["python3"]