Giter Club home page Giter Club logo

liqiaowei-docker-django-nginx-uwsgi-py3.6's Introduction

torchcc/docker-drf:py3.6-alpine3.8

docker image for django (uwsgi) & nginx & supervisord based on tiangolo/uwsgi-nginx:python3.6-alpine3.8

files required

  • Dockerfile, supervisord.ini, django_nginx.conf, uwsgi.ini
    • app: the dir where manage.py locates. it is used for mounting using docker syntax like -v dira: dirb
    • django_nginx.conf: the nignx configuration of your app
    • django_supervisord.ini: the supervisord configuration
    • app/requirements.txt: the requirements installed when building the image
    • start.sh: the scripts executed when starting a container

tips

  1. Shell scripts in Alpine starts with #! /bin/sh as the first line
  2. if it fails to install new requirements.txt in alpine, pls use
    apk add --no-cache --virtual .build-deps gcc ... ... and to install the basic package needed and then install
    your new requirements.txt and then apk del .build-deps to delete the dir
    to save space as demonstrated in the Dockerfile
  3. here is the link to the base image: https://github.com/tiangolo/uwsgi-nginx-docker/tree/master/python3.6-alpine3.8
  4. The logs of nginx and uwsgi locate in /tmp
  5. The port to which the nginx listen is 80 as is set in django_nginx.conf

usage

  • To build an image from Dockerfile
    docker build -t torchcc/docker-drf:py3.6-alpine3.8 .

  • To pull this image:
    docker pull torchcc/docker-drf:py3.6-alpine3.8

  • To Deploy your own project:
    docker run --name myapp-con -d -e MODULE=myapp_api -v /home/myapp:/opt/django/app -p ::80 torchcc/docker-drf:py3.6-alpine3.8

    • MODULE:the package name where the settings.py lies
  • To start a testing project. It runs a default 'welcome to django' project.
    docker run --name myapp-con -d -p ::80 torchcc/docker-drf:py3.6-alpine3.8

  • To run a shell script before starting supervisord, you could write a script named prestart.sh and put it in \ the same directory as manage.py and do something inside.

#! /bin/sh

pip install --upgrade pip -r /opt/django/app/my_requirements.txt
pip install requests
rm -rf ~/.cache/pip 

liqiaowei-docker-django-nginx-uwsgi-py3.6's People

Contributors

torchcc 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.