how to make docker image of your django app

20 views
Skip to first unread message

Anirudh choudhary

unread,
Jun 17, 2020, 9:51:52 AM6/17/20
to django...@googlegroups.com
I Want to make make a docker image of my Django app using PostgreSQL and unicorn. but I can't find any good tutorial for reference 
please share my link to if you know any good tutorial 

My Dockerfile now is like 
FROM python:3.6
ENV PYTHONUNBUFFERED 1
RUN mkdir /app
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
RUN apt install postgresql-client
RUN mkdir postgresqlcode
COPY /private_key/client-cert.pem /private_key/client-cert.pem
COPY /private_key/client-cert.pem /private_key/client-cert.pem
COPY /private_key/client-cert.pem /private_key/client-cert.pem
RUN psql "sslmode=verify-ca sslrootcert=\server-ca.pem \
sslcert=client-cert.pem sslkey=\client-key.pem \
hostaddr=hostaddress \
port=port \
user=postgres dbname=postgres"
COPY . /code/


I know I have to make Django-compose.yml file and I ha







Jason Turner

unread,
Jun 17, 2020, 9:58:48 AM6/17/20
to django...@googlegroups.com
https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/

Also, Will Vincent's book "Django for Professionals" is a good resource. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL8_rkEBoEuAC7N9XCgDsakOVSsGtM1EM_3bZc9azOL3jPhDjw%40mail.gmail.com.

onlinejudge95

unread,
Jun 17, 2020, 10:06:50 AM6/17/20
to django...@googlegroups.com
On Wed, Jun 17, 2020 at 7:28 PM Jason Turner <jrturn...@gmail.com> wrote:
https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/

Also, Will Vincent's book "Django for Professionals" is a good resource. 

On Wed, Jun 17, 2020, 8:51 AM Anirudh choudhary <anirudhch...@gmail.com> wrote:
I Want to make make a docker image of my Django app using PostgreSQL and unicorn. but I can't find any good tutorial for reference 
please share my link to if you know any good tutorial 
The first philosophy of docker is to run a single service in a container, which would translate to you running 2 containers.
  1. Django container having all your Django code
  2. DB container having your DB 
Now you can(i would say must) leverage docker-compose for local development. It's somewhat easy to learn, just follow along with the official docs.
Reply all
Reply to author
Forward
0 new messages