Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile to Python 3.6 with Alpine Linux #14

Closed
wants to merge 1 commit into from
Closed

Dockerfile to Python 3.6 with Alpine Linux #14

wants to merge 1 commit into from

Conversation

ProgEsteves
Copy link

@ProgEsteves ProgEsteves commented Oct 5, 2017

Same strategy another PR.
Refs #11

Output

$ docker build -t prog/uwsgi-nginx:python3.6 .
Sending build context to Docker daemon  10.24kB
Step 1/18 : FROM python:3.6-alpine
3.6-alpine: Pulling from library/python
90f4dba627d6: Already exists 
a615e2cf13bb: Already exists 
27f6956ae76d: Pull complete 
b61bcf45b1cc: Pull complete 
ec3973580737: Pull complete 
Digest: sha256:fad0ea65ba5653242b7289a08be6cc7149f441742d9a12f74f4695963c72db76
Status: Downloaded newer image for python:3.6-alpine
 ---> d26cf7d4701d
Step 2/18 : MAINTAINER Sebastian Ramirez <[email protected]>
 ---> Running in a189f63eaad6
 ---> f1771991b831
Removing intermediate container a189f63eaad6
Step 3/18 : ENV NGINX_VERSION 1.12.1
 ---> Running in 6279175d1a73
 ---> 8599405d0cc7
Removing intermediate container 6279175d1a73
Step 4/18 : RUN apk update     && apk add --no-cache --virtual .build-deps 	gcc 	libc-dev 	linux-headers 	bash     nginx     supervisor
 ---> Running in e3fdfd4a8c35
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
v3.4.6-215-g0e92484 [http://dl-cdn.alpinelinux.org/alpine/v3.4/main]
v3.4.6-160-g14ad2a3 [http://dl-cdn.alpinelinux.org/alpine/v3.4/community]
OK: 5974 distinct packages available
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/25) Installing binutils-libs (2.26-r1)
(2/25) Installing binutils (2.26-r1)
(3/25) Installing gmp (6.1.0-r0)
(4/25) Installing isl (0.14.1-r0)
(5/25) Installing libgomp (5.3.0-r0)
(6/25) Installing libatomic (5.3.0-r0)
(7/25) Installing libgcc (5.3.0-r0)
(8/25) Installing pkgconf (0.9.12-r0)
(9/25) Installing pkgconfig (0.25-r1)
(10/25) Installing mpfr3 (3.1.2-r0)
(11/25) Installing mpc1 (1.0.3-r0)
(12/25) Installing libstdc++ (5.3.0-r0)
(13/25) Installing gcc (5.3.0-r0)
(14/25) Installing musl-dev (1.1.14-r15)
(15/25) Installing libc-dev (0.7-r0)
(16/25) Installing linux-headers (4.4.6-r1)
(17/25) Installing bash (4.3.42-r5)
Executing bash-4.3.42-r5.post-install
(18/25) Installing nginx-common (1.10.3-r0)
Executing nginx-common-1.10.3-r0.pre-install
(19/25) Installing pcre (8.38-r1)
(20/25) Installing nginx (1.10.3-r0)
(21/25) Installing python (2.7.12-r0)
(22/25) Installing py-meld3 (1.0.2-r0)
(23/25) Installing py-setuptools (20.8.0-r0)
(24/25) Installing supervisor (3.2.4-r0)
(25/25) Installing .build-deps (0)
Executing busybox-1.24.2-r13.trigger
OK: 168 MiB in 59 packages
 ---> e56ad63bcee1
Removing intermediate container e3fdfd4a8c35
Step 5/18 : RUN ln -sf /dev/stdout /var/log/nginx/access.log 	&& ln -sf /dev/stderr /var/log/nginx/error.log
 ---> Running in b5d8aa209969
 ---> 0498d4e1630b
Removing intermediate container b5d8aa209969
Step 6/18 : EXPOSE 80 443
 ---> Running in d298d2c8062d
 ---> fefd5c7059f1
Removing intermediate container d298d2c8062d
Step 7/18 : RUN echo "daemon off;" >> /etc/nginx/nginx.conf
 ---> Running in 89432eb8cd42
 ---> a06563221c08
Removing intermediate container 89432eb8cd42
Step 8/18 : COPY nginx.conf /etc/nginx/conf.d/
 ---> 310ece3892eb
Removing intermediate container 6970251c3fcb
Step 9/18 : COPY uwsgi.ini /etc/uwsgi/
 ---> 067f44768ec6
Removing intermediate container c4545b51f175
Step 10/18 : RUN pip install uwsgi
 ---> Running in e6ac416df486
Collecting uwsgi
  Downloading uwsgi-2.0.15.tar.gz (795kB)
Building wheels for collected packages: uwsgi
  Running setup.py bdist_wheel for uwsgi: started
  Running setup.py bdist_wheel for uwsgi: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/26/d0/48/e7b0eed63b5d191e89d94e72196aafae93b2b6505a9feafdd9
Successfully built uwsgi
Installing collected packages: uwsgi
Successfully installed uwsgi-2.0.15
 ---> e73928ad87cb
Removing intermediate container e6ac416df486
Step 11/18 : ENV UWSGI_INI /app/uwsgi.ini
 ---> Running in b1349aebf05c
 ---> 45cdf77da34b
Removing intermediate container b1349aebf05c
Step 12/18 : ENV NGINX_MAX_UPLOAD 0
 ---> Running in 8d39b603cbf2
 ---> 14e04b678bea
Removing intermediate container 8d39b603cbf2
Step 13/18 : COPY entrypoint.sh /entrypoint.sh
 ---> 8b484ee24796
Removing intermediate container f8c5f8230e80
Step 14/18 : RUN chmod +x /entrypoint.sh
 ---> Running in 71a598fd1f60
 ---> 8103f9042179
Removing intermediate container 71a598fd1f60
Step 15/18 : ENTRYPOINT /entrypoint.sh
 ---> Running in 877a87a3bcae
 ---> 0a1abf4b5620
Removing intermediate container 877a87a3bcae
Step 16/18 : COPY ./app /app
 ---> 8766f2e6912b
Removing intermediate container a1d90385f57c
Step 17/18 : WORKDIR /app
 ---> 78b09ef0edb8
Removing intermediate container 15f99b8423f5
Step 18/18 : CMD /usr/bin/supervisord
 ---> Running in e8a05f20a0c1
 ---> c1d44fe4b11d
Removing intermediate container e8a05f20a0c1
Successfully built c1d44fe4b11d
Successfully tagged prog/uwsgi-nginx:python3.6

Images

REPOSITORY             TAG                 IMAGE ID            CREATED              SIZE
prog/uwsgi-nginx       python3.6           c1d44fe4b11d        About a minute ago   233MB
tiangolo/uwsgi-nginx   python3.6           6ef66e84f1fc        7 weeks ago          702MB

@jaustinpage
Copy link

lgtm, @tiangolo what would you see this PR needing in order to be merged in? anything I can help with?

@tiangolo
Copy link
Owner

tiangolo commented Dec 12, 2017

Thanks for the work @ProgEsteves and thanks for the offering @jaustinpage .

I just updated the base (Debian) image on the last weekend, to have the latest version of Python and Nginx. I also added the ability to run a prescript (e.g. for migrations) in the Flask image based on this one. I wanted to define how to do that before adding the Alpine version, to simplify things.

I wanted to do something similar for the Alpine version. I wanted to check what is the building process of the official Nginx image in the Alpine flavor and the best way to merge it with the Python image in the Alpine flavor.

My intention is to have the images very close to those two official base images. That will simplify things and facilitate features.

I hope to check and merge this (maybe with some adjustments) on the next weekend.

The Alpine flavor is definitely gonna happen soon. At least for Python 3.6.

@tiangolo
Copy link
Owner

First, many thanks for the hard work @ProgEsteves .

I wanted to follow the same procedure I used for the other "flavors" of this image. I started from a Python official base image and then I copied (most of) the contents of the Dockerfile for the official Nginx image.

That allows it to have the same behavior that users might expect as with the official image as some other advantages.

There are also a couple of minor improvements.

The current code is in: https://github.com/tiangolo/uwsgi-nginx-docker/tree/master/python3.6-alpine3.7

The Docker Hub image tag lives in: tiangolo/uwsgi-nginx:python3.6-alpine3.7 if you have the chance to test it.

It would be great if any of you has the chance to test it and let me know how it works.

@tiangolo
Copy link
Owner

Thanks for your work! It helped / inspired the creation of the new Alpine images. They have been there for a while and seem to be working, so I'll close this now. If you find any issue with them, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants