From ab0c7899c96d40f8a11ce21f82f4fe674333b55e Mon Sep 17 00:00:00 2001 From: Raman Chaudhary <97114586+ChaudharyRaman@users.noreply.github.com> Date: Fri, 17 Nov 2023 00:22:02 +0530 Subject: [PATCH] Feat : docker initialised : backend (#101) * docker initialised: backend * changes * changes --- backend/.dockerignore | 1 + backend/Dockerfile | 8 ++++++++ backend/core/settings.py | 3 ++- docker-compose.yml | 16 ++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 backend/.dockerignore create mode 100644 backend/Dockerfile create mode 100644 docker-compose.yml diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 0000000..f5e96db --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1 @@ +venv \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..22ae679 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.10-alpine +WORKDIR /usr/src/app +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 +RUN pip install --upgrade pip +COPY requirements.txt . +RUN pip install -r requirements.txt +COPY . . \ No newline at end of file diff --git a/backend/core/settings.py b/backend/core/settings.py index 143d011..2e0da87 100644 --- a/backend/core/settings.py +++ b/backend/core/settings.py @@ -16,7 +16,8 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] +# ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS').split(' ') CORS_ORIGIN_ALLOW_ALL = False CORS_ORIGIN_WHITELIST = ['http://localhost:3000', ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d331261 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.8" +services: + backend: + # restart: always + container_name: django + build: + context: ./backend + command: python manage.py runserver 0.0.0.0:8000 + ports: + - 8000:8000 + volumes: + - ./backend/:/usr/src/app/ + environment: + - DEBUG=1 + - SECRET_KEY=35%fnl)_3v67^9os3%5bo+vv)$l&a6k#_&21i-xl7%_%#sa5(v + - DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1