diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..07bb2a4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.8 + +ENV PYTHONUNBUFFERED 1 +ENV DJANGO_SETTINGS_MODULE Sprint.settings +RUN mkdir -p /usr/src/app/ +WORKDIR /usr/src/app/ + +COPY . /usr/src/app/ + +RUN pip install -r requirements.txt + +EXPOSE 8000 diff --git a/Sprint/settings.py b/Sprint/settings.py index 34167a5..912fb17 100644 --- a/Sprint/settings.py +++ b/Sprint/settings.py @@ -87,8 +87,12 @@ WSGI_APPLICATION = 'Sprint.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': os.getenv('POSTGRES_DB'), + 'USER': os.getenv('POSTGRES_USER'), + 'PASSWORD': os.getenv('POSTGRES_PASSWORD'), + 'HOST': '0.0.0.0', + 'PORT': '5432', } } @@ -138,7 +142,7 @@ USE_TZ = True STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, "static_root") +STATIC_ROOT = os.path.join(BASE_DIR, "static") MEDIA_ROOT = os.path.join(BASE_DIR, 'data') diff --git a/docker-compose.yaml b/docker-compose.yaml index e69de29..d5b6e40 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -0,0 +1,27 @@ +version: "3" + + +services: + redis: + image: redis:alpine + command: redis-server + celery: + restart: always + build: . + command: "celery -A Sprint worker -l INFO" + volumes: + - .:/app + depends_on: + - redis + postgres: + restart: always + image: postgres + environment: + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + ports: + - "5432:5432" + volumes: + - postgres_data:/var/lib/postgres + - ./dbscripts/postgres:/docker-entrypoint-initdb.d diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..85ec828 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,32 @@ +amqp==1.4.9 +anyjson==0.3.3 +asgiref==3.4.1 +billiard==3.3.0.23 +celery==3.1.26.post2 +click==7.1.2 +click-didyoumean==0.0.3 +click-plugins==1.1.1 +click-repl==0.2.0 +copydetect==0.2.1 +cycler==0.10.0 +Django==3.2.5 +django-celery==3.3.1 +django-grappelli==2.15.1 +Jinja2==3.0.1 +kiwisolver==1.3.1 +kombu==3.0.37 +MarkupSafe==2.0.1 +matplotlib==3.4.2 +numpy==1.21.0 +Pillow==8.3.1 +prompt-toolkit==3.0.19 +psycopg2==2.9.1 +Pygments==2.9.0 +pyparsing==2.4.7 +python-dateutil==2.8.1 +pytz==2021.1 +six==1.16.0 +sqlparse==0.4.1 +tqdm==4.61.2 +vine==5.0.0 +wcwidth==0.2.5