Dockerfile split into prod and dev

This commit is contained in:
ayxan 2023-01-31 21:03:07 +04:00
parent 54d02bd56e
commit ee6b5e51c1
6 changed files with 39 additions and 7 deletions

View File

@ -1,5 +1,3 @@
src/celerybeat-schedule
src/.env.example
src/db.sqlite3
config/db/databasepostgresql_env.example
**/*.example
**/__pycache__

6
Docker/Dev/Dockerfile Normal file
View File

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

View File

@ -0,0 +1,18 @@
version: "3.9"
services:
django:
restart: always
environment:
- DJANGO_SETTINGS_MODULE=config.settings.development
build:
context: ../../
dockerfile: Docker/Dev/Dockerfile
command: >
bash -c "python3 src/manage.py makemigrations
&& python3 src/manage.py migrate
&& python src/manage.py runserver 0.0.0.0:8000"
ports:
- "8000:8000"
volumes:
- ../../src:/code/src

View File

@ -15,8 +15,13 @@ services:
restart: always
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
build: .
command: gunicorn --chdir src --bind 0.0.0.0:8000 config.wsgi
build:
context: ../../
dockerfile: Docker/Prod/Dockerfile
command: >
bash -c "python3 src/manage.py makemigrations
&& python3 src/manage.py migrate
&& gunicorn --chdir src --bind 0.0.0.0:8000 config.wsgi"
ports:
- "8000:8000"
depends_on:

View File

@ -15,8 +15,13 @@ services:
restart: always
environment:
- DJANGO_SETTINGS_MODULE=config.settings.production
build: .
command: gunicorn --chdir src --bind 0.0.0.0:8000 config.wsgi
build:
context: ../../
dockerfile: Docker/Prod/Dockerfile
command: >
bash -c "python3 src/manage.py makemigrations
&& python3 src/manage.py migrate
&& gunicorn --chdir src --bind 0.0.0.0:8000 config.wsgi"
ports:
- "8000:8000"
depends_on: