Skip to content

Tests are not purged successfully during build on alpine #98

@ushuz

Description

@ushuz

It seems that find -exec rm -rf '{}' + command that is used to purge tests and *.py[co] (https://github.com/docker-library/python/blob/master/2.7/alpine/Dockerfile#L46-L49) didn't achieve its goal. The tests are still in the image, and contribute 16~20M image size.

You can check it out by running

$ docker run --rm python:2-alpine find /usr/local \( -type d -a -name test -o -name tests \) -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \)
/usr/local/lib/python2.7/lib2to3/tests
/usr/local/lib/python2.7/ctypes/test
/usr/local/lib/python2.7/json/tests
/usr/local/lib/python2.7/sqlite3/test
/usr/local/lib/python2.7/lib-tk/test
/usr/local/lib/python2.7/unittest/test
/usr/local/lib/python2.7/distutils/tests
/usr/local/lib/python2.7/test
/usr/local/lib/python2.7/site-packages/wheel/test
/usr/local/lib/python2.7/email/test
/usr/local/lib/python2.7/bsddb/test
$ docker run --rm python:alpine find /usr/local \( -type d -a -name test -o -name tests \) -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \)
/usr/local/lib/python3.5/lib2to3/tests
/usr/local/lib/python3.5/ctypes/test
/usr/local/lib/python3.5/sqlite3/test
/usr/local/lib/python3.5/unittest/test
/usr/local/lib/python3.5/distutils/tests
/usr/local/lib/python3.5/test
/usr/local/lib/python3.5/tkinter/test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions