init Create a Docker Image for the backend Setup #115

This commit is contained in:
karthik murakonda 2022-06-05 01:11:37 +05:30
parent a5d620ec82
commit f85b591397
5 changed files with 46 additions and 1 deletions

5
.gitignore vendored
View File

@ -64,6 +64,10 @@ db.sqlite3-journal
instance/ instance/
.webassets-cache .webassets-cache
# docker stuff:
data/
docker.env
# Scrapy stuff: # Scrapy stuff:
.scrapy .scrapy
@ -139,3 +143,4 @@ dmypy.json
/CDC_Backend/Storage/ /CDC_Backend/Storage/
.idea .idea
*.pyc *.pyc

View File

@ -29,7 +29,7 @@ SECRET_KEY = 'e_i2g3z!y4+p3dwm%k9k=zmsot@aya-0$mmetgxz4mp#8_oy#*'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ALLOWED_HOSTS = ['cdc-iitdh.herokuapp.com/', 'localhost', '192.168.29.199'] ALLOWED_HOSTS = ['cdc-iitdh.herokuapp.com/', 'localhost', '192.168.29.199', '127.0.0.1']
# Application definition # Application definition

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM python:3
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/

22
docker-compose.yaml Normal file
View File

@ -0,0 +1,22 @@
version: "3.9"
services:
db:
image: postgres
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
web:
build: .
command: python3 manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
working_dir: /code/CDC_backend
ports:
- "8000:8000"
env_file: docker.env
depends_on:
- db

11
example.docker.env Normal file
View File

@ -0,0 +1,11 @@
DEBUG=True
EMAIL=<EMAIL>
EMAIL_PASSWORD=<APP_SECRET>
SECRET_KEY=<OUR_SECRET_KEY>
EMAIL_VERIFICATION_SECRET_KEY=<OUR_SECRET_KEY>
DB_NAME=<DB_NAME>
DB_USER=<DB_USER>
DB_PASSWORD=<DB_PASSWORD>
DB_HOST=db
DB_PORT=5432
RECAPTCHA_SECRET_KEY=<RECAPTCHA_SECRET_KEY>