Skip to content

dazza-codes/docker-python

Repository files navigation

docker-python

This project is motivated by trying to use docker-in-docker for gitlab-CI that runs python test suites where something needs a docker container/service.

THIS IS NOT AN OFFICIAL DOCKER or PYTHON repository and NO SUPPORT will be provided and issues might not get any attention. See the links below for official projects. Feel free to use this repository to push changes upstream to official projects - it's all Apache-2.0; if the approaches in this repository are pushed upstream, it should die a natural deprecation. If you need changes, review the links below and fork it to do it yourself; PRs are welcome but don't expect anything to change in a timely manner.

In the builds of this project, the build-deps are kept in the image so that python libraries can easily build wheels when needed. Many users of alpine want smaller images, but at the expense of convencience for python packages that build wheels. If your looking for a small python image, this might not be for you.

When using a docker image from this project, DO NOT apk add python3. Also understand that any use of apk add py3-* could be broken. If all you want is to use python3 on an alpine based docker container, DO NOT use this project, use the latest python provided by apk add python3.

Approach

Docker Images

Use

make update
PY_VER=3.6 make build
PY_VER=3.7 make build
PY_VER=3.8 make build

Each build will run python tests. If they build, they should be OK, but check each build with something like:

PY_VER=3.6 make shell
# python --version
# python
>>> import random
>>> random.uniform(1,10)

In the builds of this project, the build-deps are kept in the image so that python libraries can easily build wheels when needed. Many users of alpine want smaller images, but at the expense of convencience for python packages that build wheels. If your looking for a small python image, this might not be for you. For a more demanding test that needs some build-deps, try:

pip install cffi

If it looks OK, it could get pushed to DockerHub (requires a manual login):

PY_VER=3.6 make push

License


   Copyright 2020 Darren Weber

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

About

Use docker as a base image to build python on alpine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published