Coder Social home page Coder Social logo

batmanwgd / ubuntu-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rcarmo/ubuntu-python

0.0 1.0 0.0 48 KB

A base Docker container for running Python apps with an Ubuntu userland

License: MIT License

Makefile 59.54% Dockerfile 40.46%

ubuntu-python's Introduction

ubuntu-python

Docker Stars Docker Pulls

A base Docker container for running Python apps with an Ubuntu userland, based on alpine-python and build for three different architectures:

  • amd64
  • arm32v7 (Pi 2+ or other ARM 32-bit boards like the ODROID U2+)
  • arm64v8 (Pi 4 or other ARM 64-bit boards, as well as the WSL images for Windows on ARM)

Why

alpine-python makes for awesome small containers, but it's a pain to deal with all the binary wheels related to machine/deep learning stuff like Tensorflow, numpy, etc., so I decided to bite the bullet and take on the extra bloat that comes with an Ubuntu distro.

Status & Roadmap

  • Multi-stage, "stripped" builds (requires some tuning of the onbuild images)
  • Multi-arch builds
  • CI builds (WIP due to long build times - Travis errors out)
  • Python 3.8.5
  • Python 3.7.5
  • Python 3.7.3
  • Normalize architecture tags (arm32v7, amd64, etc. to match Docker naming conventions)
  • Python 3.7.0
  • Move to Ubuntu 18.04 base image
  • LTO (experimental) optimizations, inspired by revsys
  • Initial armhf containers
  • Initial amd64 containers, plain + onbuild
  • Python 3.6.3 (amd64)
  • Scaffolding for multiarch builds
  • Base userland with required libraries for building Python 3.6

Usage

This image runs the python command on docker run. You can either specify your own command, e.g:

docker run --rm -ti rcarmo/ubuntu-python python hello.py

Or extend this image using your custom Dockerfile, e.g:

FROM rcarmo/ubuntu-python:onbuild
# or FROM rcarmo/ubuntu-python:3.8-onbuild-amd64 if you prefer to specify your architecture

# for a flask server
EXPOSE 5000
CMD python manage.py runserver

Dont' forget to build your image:

docker build --rm=true -t rcarmo/app .

You can also access bash inside the container:

docker run --rm -ti rcarmo/ubuntu-python /bin/bash

Another option is to build an extended Dockerfile version (like shown above), and mount your application inside the container:

docker run --rm -v "$(pwd)":/home/app -w /home/app -p 5000:5000 -ti rcarmo/app

Details

  • Builds the Python interpreter with optimizations enabled, for a significant performance boost
  • You can use the latest or onbuild tags, but every variant is tagged with its architecture and build step purpose
  • Uses make altinstall to have Python 3.8 coexist with the built-in Ubuntu Python (which is nearly impossible to eradicate anyway)
  • Just like the main python docker image, it creates useful symlinks that are expected to exist, e.g. python3.8 > python, pip3.8 > pip, etc.)

ubuntu-python's People

Contributors

rcarmo avatar

Watchers

 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.