GithubHelp home page GithubHelp logo

shixiangbupt / python3-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eht16/python3-docker

0.0 1.0 0.0 26 KB

A slim Python 3 image for Docker

License: MIT License

Python 37.95% Dockerfile 62.05%

python3-docker's Introduction

Python 3 image for Docker

About

A slim Python 3 image for Docker. Currently the resulting image contains Python 3.10, compiled from source and the pip and wheel packages are included.

This is heavily inspired from the official Python image at https://github.com/docker-library/python/blob/master/3.9/buster/slim/Dockerfile but has a few differences:

  • use multi-stage build in Dockerfile to ease the build step and still get a small image
  • build Python without the ncurses, readline and tk modules for image size, assuming a non-interactively used Python interpreter does not need these modules
  • the Python interpreter is installed to /python

The Dockerfile uses debian:bullseye-slim (https://hub.docker.com/_/debian/) as base but this is configurable at build time using BASE_IMAGE_NAME as build argument. Tested with debian:buster-slim, debian:bullseye-slim and ubuntu:18.04, the Dockerfile generally should work with most Debian based base images.

Motivation

  • Be able to specify a custom base image
  • Have a Python Docker image as small as possible while still usable for most use cases

Build

Just build the image:

docker build --tag python3:latest .

Use a different base image:

docker build --build-arg BASE_IMAGE_NAME=ubuntu:bionic --tag python3:bionic .

Usage

By default, the Python interpreter is started when the image is ran:

docker run --rm -it --name python3 python3:latest

To change this, just overwrite the CMD instruction in your Dockerfile.

License

Licensed under the MIT License.

Author

Enrico Tröger [email protected]

python3-docker's People

Contributors

eht16 avatar cobaltgit avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.