FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove unused files to make the Docker image smaller by duggelz · Pull Request #117 · GoogleCloudPlatform/python-runtime · GitHub

This repository was archived by the owner on Aug 5, 2026. It is now read-only.

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .in  (1) .sh  (2) .yaml  (4) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions cloudbuild.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ steps:
'--config', '/workspace/tests/virtualenv/virtualenv_default.yaml',
'--config', '/workspace/tests/virtualenv/virtualenv_python34.yaml',
'--config', '/workspace/tests/virtualenv/virtualenv_python35.yaml',
'--config', '/workspace/tests/virtualenv/virtualenv_python36.yaml',
'--config', '/workspace/tests/no-virtualenv/no-virtualenv.yaml',
'--config', '/workspace/tests/python2-libraries/python2-libraries.yaml',
'--config', '/workspace/tests/python3-libraries/python3-libraries.yaml',
Expand Down
4 changes: 2 additions & 2 deletions python-interpreter-builder/Dockerfile.in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ RUN apt-get update && apt-get install -yq \
wget \
xauth \
xvfb \
zlib1g-dev

zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Setup locale. This prevents Python 3 IO encoding issues.
ENV LANG C.UTF-8
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ QUILT_PATCHES=/patches/3.5 quilt push -a
# Specifically EXTRA_CFLAGS="-g -flto -fuse-linker-plugin
# -ffat-lto-objects"

PREFIX=/opt/python3.5

mkdir build-static
cd build-static

../configure \
--enable-ipv6 \
--enable-loadable-sqlite-extensions \
--enable-optimizations \
--prefix=/opt/python3.5 \
--prefix="$PREFIX" \
--with-dbmliborder=bdb:gdbm \
--with-computed-gotos \
--with-fpectl \
Expand All @@ -117,13 +119,32 @@ cd build-static
RANLIB="x86_64-linux-gnu-gcc-ranlib" \

make profile-opt
make altinstall

# Run tests
# test___all__: Depends on Debian-specific locale changes
# test_dbm: https://bugs.python.org/issue28700
# test_imap: https://bugs.python.org/issue30175
# test_shutil: https://bugs.python.org/issue29317
make test TESTOPTS="--exclude test___all__ test_imaplib test_shutil"
make test TESTOPTS="--exclude test___all__ test_dbm test_imaplib test_shutil"

# Install
make altinstall
# We don't expect users to statically link Python into a C/C++ program
rm "$PREFIX"/lib/libpython3.5m.a \
"$PREFIX"/lib/python3.5/config-*/libpython3.5m.a
# Remove opt-mode bytecode
find "$PREFIX"/lib/python3.5/ \
-name \*.opt-\?.pyc \
-exec rm {} \;
# Remove all but a few files in the 'test' subdirectory
find "$PREFIX"/lib/python3.5/test \
-mindepth 1 -maxdepth 1 \
\! -name support \
-a \! -name __init__.py \
-a \! -name pystone.\* \
-a \! -name regrtest.\* \
-a \! -name test_support.py \
-exec rm -rf {} \;

# Clean-up sources
cd /opt
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ QUILT_PATCHES=/patches/3.6 quilt push -a
# Specifically EXTRA_CFLAGS="-g -flto -fuse-linker-plugin
# -ffat-lto-objects"

PREFIX=/opt/python3.6

mkdir build-static
cd build-static

../configure \
--enable-ipv6 \
--enable-loadable-sqlite-extensions \
--enable-optimizations \
--prefix=/opt/python3.6 \
--prefix="$PREFIX" \
--with-dbmliborder=bdb:gdbm \
--with-computed-gotos \
--with-fpectl \
Expand All @@ -117,7 +119,6 @@ cd build-static
RANLIB="x86_64-linux-gnu-gcc-ranlib" \

make profile-opt
make altinstall

# Run tests
# test___all__: Depends on Debian-specific locale changes
Expand All @@ -126,6 +127,25 @@ make altinstall
# test_shutil: https://bugs.python.org/issue29317
make test TESTOPTS="--exclude test___all__ test_dbm test_imaplib test_shutil"

# Install
make altinstall
# We don't expect users to statically link Python into a C/C++ program
rm "$PREFIX"/lib/libpython3.6m.a \
"$PREFIX"/lib/python3.6/config-*/libpython3.6m.a
# Remove opt-mode bytecode
find "$PREFIX"/lib/python3.6/ \
-name \*.opt-\?.pyc \
-exec rm {} \;
# Remove all but a few files in the 'test' subdirectory
find "$PREFIX"/lib/python3.6/test \
-mindepth 1 -maxdepth 1 \
\! -name support \
-a \! -name __init__.py \
-a \! -name pystone.\* \
-a \! -name regrtest.\* \
-a \! -name test_support.py \
-exec rm -rf {} \;

# Clean-up sources
cd /opt
rm /opt/sources/Python-3.6.1.tgz
Expand Down
3 changes: 3 additions & 0 deletions tests/virtualenv/virtualenv_python34.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ commandTests:

- name: "flask integration"
command: ["python", "-c", "\"import sys; import flask; sys.exit(0 if flask.__file__.startswith('/env') else 1)\""]

- name: "test.support"
command: ["python", "-c", "\"from test import pystone, regrtest, support\""]
3 changes: 3 additions & 0 deletions tests/virtualenv/virtualenv_python35.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ commandTests:

- name: "flask integration"
command: ["python", "-c", "\"import sys; import flask; sys.exit(0 if flask.__file__.startswith('/env') else 1)\""]

- name: "test.support"
command: ["python", "-c", "\"from test import pystone, regrtest, support\""]
5 changes: 4 additions & 1 deletion tests/virtualenv/virtualenv_python36.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ commandTests:

- name: "python version"
command: ["python", "--version"]
expectedOutput: ["Python 3.6.3\n"]
expectedOutput: ["Python 3.6.1\n"]

- name: "pip installation"
command: ["which", "pip"]
Expand All @@ -46,3 +46,6 @@ commandTests:

- name: "flask integration"
command: ["python", "-c", "\"import sys; import flask; sys.exit(0 if flask.__file__.startswith('/env') else 1)\""]

- name: "test.support"
command: ["python", "-c", "\"from test import pystone, regrtest, support\""]

Back | FazBrowse Home | New Git URL