Sign inSign up

mmnhsn/django2hybrid

By mmnhsn

•Updated over 7 years ago

docker run -d --name myapp -p 8000:80 -v $(pwd):/app mmnhsn/django2hybrid

Image
0

50K+

mmnhsn/django2hybrid repository overview

⁠nginx/.htpasswd

sudo sh -c "echo -n 'lotd:' >> nginx/.htpasswd"
sudo sh -c "openssl passwd -apr1 >> nginx/.htpasswd"

⁠nginx/sites-available/default

server {
	listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    index index.html;

	server_name _;

	location /docs {
	    autoindex on;
	    alias /app/docs/_build/html;
	    try_files $uri $uri/ =404;
	    auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;
	}

	location /static {
	    autoindex on;
	    alias /app/static;
	    try_files $uri $uri/ =404;
	}

    location / {
       proxy_pass http://0.0.0.0:8000/;
    }
}

⁠Dockerfile


FROM python:3.6

RUN apt-get update \
    && apt-get install -y --no-install-recommends postgresql-client nginx \
    && rm -rf /var/lib/apt/lists/*

COPY nginx/.htpasswd ./etc/nginx/.htpasswd
COPY nginx/sites-available/ ./etc/nginx/sites-available/

WORKDIR /app
COPY requirements.txt ./
RUN pip install --upgrade pip && pip install -r requirements.txt
COPY . .

EXPOSE 80

CMD make html -C docs && service nginx restart && gunicorn app.wsgi -b 0.0.0.0:8000

Tag summary

Content type

Image

Digest

Size

598.9 MB

Last updated

over 7 years ago

docker pull mmnhsn/django2hybrid