Skip to content

Commit

Permalink
Merge pull request #187 from bounswe/docker
Browse files Browse the repository at this point in the history
Apply changes in docker to fixed backend code
  • Loading branch information
KeremZaman committed Nov 15, 2021
2 parents 82bc4b6 + 9da4222 commit dcfeeaa
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
14 changes: 14 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.6

ADD requirements.txt .
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

ADD . /
WORKDIR /

CMD python manage.py makemigrations authentication eventposts
CMD python manage.py migrate authentication eventposts
CMD gunicorn --bind 0.0.0.0:9000 -w 1 app.wsgi

EXPOSE 9000
7 changes: 4 additions & 3 deletions backend/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
SECRET_KEY = 'django-insecure-c90htu(asg$c7d_bexlhc)3csc2w4hi$49@uv8rt0w3_asva-j'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = os.environ.get('DEBUG', None) == 'True'

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['*']


# Application definition
Expand Down Expand Up @@ -90,7 +90,8 @@

'HOST': 'localhost' if DEBUG else 'database',

'PORT': '' #5432

'PORT': '5432',

}
}
Expand Down
7 changes: 7 additions & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
django
gunicorn
psycopg2
djangorestframework
djangorestframework-jsonapi
djangorestframework_simplejwt
django_rest_passwordreset
3 changes: 3 additions & 0 deletions database.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_USER=rebound_user
POSTGRES_PASSWORD=-#My6o0dPa33W0rd#-
POSTGRES_DB=rebound_db
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3"
services:
backend:
build: backend
ports:
- "9000:9000"
environment:
WAIT_HOSTS: database:5432
DEBUG: 'False'
env_file:
- database.env
database:
image: "postgres:latest"
env_file:
- database.env
ports:
- "5432:5432"
volumes:
- database-data:/var/lib/postgresql/data/

volumes:
database-data:

0 comments on commit dcfeeaa

Please sign in to comment.