Docker config for testing python-build (#1548)
* Dockerfile for testing python builds * README: document docker usage * Finish docker dockerignore file, specify ephemeral nature of containers. * Move docs for docker usage to python-build README
This commit is contained in:
parent
9052491a05
commit
23677c5124
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.git/
|
||||||
|
.python-version
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
|
LABEL maintainer="Chris L. Barnes <chrislloydbarnes@gmail.com>"
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update -y \
|
||||||
|
&& apt-get install -y \
|
||||||
|
make \
|
||||||
|
build-essential \
|
||||||
|
libssl-dev \
|
||||||
|
zlib1g-dev \
|
||||||
|
libbz2-dev \
|
||||||
|
libreadline-dev \
|
||||||
|
libsqlite3-dev \
|
||||||
|
wget \
|
||||||
|
curl \
|
||||||
|
llvm \
|
||||||
|
libncurses5-dev \
|
||||||
|
libncursesw5-dev \
|
||||||
|
xz-utils \
|
||||||
|
tk-dev \
|
||||||
|
libffi-dev \
|
||||||
|
liblzma-dev \
|
||||||
|
python-openssl \
|
||||||
|
git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ENV PYENV_ROOT "/pyenv"
|
||||||
|
ENV PATH "$PYENV_ROOT/bin:$PATH"
|
||||||
|
|
||||||
|
COPY . /pyenv
|
||||||
|
|
||||||
|
RUN eval "$(pyenv init -)"
|
||||||
|
|
@ -226,3 +226,51 @@ Please see the [pyenv wiki](https://github.com/pyenv/pyenv/wiki) for solutions t
|
|||||||
If you can't find an answer on the wiki, open an issue on the [issue
|
If you can't find an answer on the wiki, open an issue on the [issue
|
||||||
tracker](https://github.com/pyenv/pyenv/issues). Be sure to include
|
tracker](https://github.com/pyenv/pyenv/issues). Be sure to include
|
||||||
the full build log for build failures.
|
the full build log for build failures.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
### Testing new python versions
|
||||||
|
|
||||||
|
If you are contributing a new python version for python-build,
|
||||||
|
you can test the build in a [docker](https://www.docker.com/) container based on Ubuntu 18.04.
|
||||||
|
|
||||||
|
With docker installed:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t my_container .
|
||||||
|
docker run my_container pyenv install <my_version>
|
||||||
|
```
|
||||||
|
|
||||||
|
To enter a shell which will allow you to build and then test a python version,
|
||||||
|
replace the second line with
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -it my_container
|
||||||
|
```
|
||||||
|
|
||||||
|
The container will need to be rebuilt whenever you change the repo,
|
||||||
|
but after the first build, this will be very fast,
|
||||||
|
as the layer including the build dependencies will be cached.
|
||||||
|
|
||||||
|
Changes made inside the container will not be persisted.
|
||||||
|
|
||||||
|
To test *all* new versions since a particular revision (e.g. `master`), `cd` to the root of your `pyenv` repo, and run this script:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
docker build -t pyenv-test-container .
|
||||||
|
|
||||||
|
git diff --name-only master \
|
||||||
|
| grep '^plugins/python-build/share/python-build/' \
|
||||||
|
| awk -F '/' '{print $NF}' \
|
||||||
|
| xargs -I _ docker run pyenv-test-container pyenv install _
|
||||||
|
```
|
||||||
|
|
||||||
|
- Build the docker image with the **t**ag pyenv-test-container
|
||||||
|
- Look for the names files changed since revision `master`
|
||||||
|
- Filter out any which don't live where python-build keeps its build scripts
|
||||||
|
- Look only at the file name (i.e. the python version name)
|
||||||
|
- Run a new docker container for each, building that version
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user