Last active
May 16, 2018 15:55
-
-
Save ryanpadilha/d352d89efb85f362fcb799f40b118d84 to your computer and use it in GitHub Desktop.
Docker Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| # Dockerfile -- Container Image for Debian 9.3 / Python 3.5 | |
| ## | |
| # build : docker build -f debian-python3.dockerfile -t debian-python3 . | |
| # tag : docker tag debian-python3 wplex/debian-python3:latest | |
| # push : docker push <user>/debian-python3 | |
| FROM debian:latest | |
| LABEL maintainer="Ryan Padilha <ryan.padilha@gmail.com>" | |
| RUN apt-get update \ | |
| && apt-get install -y python3-pip python3-dev \ | |
| && cd /usr/local/bin \ | |
| && ln -s /usr/bin/python3 python \ | |
| && pip3 install --upgrade pip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## | |
| # docker-container for Python 3.5 | |
| ## | |
| # generate-image : docker build -t flask-origins --build-arg VERSION=1.0.0 . | |
| # tag-image : docker tag flask-origins <user>/flask-origins:latest | |
| # push-image : docker push <user>/flask-origins | |
| ## | |
| # run-container : docker run -d -p 8000:8000 --name flask_origins flask-origins | |
| # container-limit : docker run --memory=750m --memory-swap=750m --oom-kill-disable -d -p 8000:8000 --name flask_origins flask-origins | |
| ## | |
| # save-image : sudo docker save flask-origins > /var/company/devops/flask-origins-docker.tar | |
| # load-image : docker load < /var/company/devops/flask-origins-docker.tar | |
| ## | |
| FROM debian-python3 | |
| LABEL maintainer="Ryan Padilha <ryan.padilha@gmail.com>" | |
| # define commonly used variables | |
| ENV APP_DIR /var/company/www/flask-origins | |
| ARG VERSION | |
| ENV VERSION $VERSION | |
| # define working directory | |
| RUN mkdir -p /var/company/www | |
| WORKDIR /var/company/www | |
| ADD target/flask-origins-$VERSION.tar.gz . | |
| EXPOSE 8000 | |
| RUN pip install --upgrade pip | |
| RUN pip install -r $APP_DIR/bin/requirements.txt | |
| RUN mkdir -p /var/company/logs/flask-origins | |
| ENTRYPOINT /usr/local/bin/gunicorn -w 3 --bind=0.0.0.0:8000 --user=root --log-level=debug --log-file=/var/company/logs/flask-origins/gunicorn.log 2>>/var/company/logs/flask-origins/gunicorn.log wsgi:application |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment