diff --git a/Dockerfile b/Dockerfile index 34102ed..0078c20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.9-alpine -WORKDIR /Forum +WORKDIR /Forum-Sandbox ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 @@ -13,4 +13,4 @@ RUN pip install --upgrade pip COPY ./requirements.txt . RUN pip3 install -r requirements.txt -COPY . /Forum +COPY . /Forum-Sandbox diff --git a/docker-compose.yml b/docker-compose.yml index 026d2f7..2df7a86 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1 +1,42 @@ -version: '' +version: '3.9' + +services: + web: + build: . + command: gunicorn forum.wsgi:application --bind 0.0.0.0:8000 + volumes: + - ./:/Forum + ports: + - 8000:8000 + env_file: + - sample.env + depends_on: + - db + db: + image: postgres:14 + restart: always + volumes: + - db_data:/var/lib/postgresql/data + environment: + POSTGRES_USER: ${PG_USER} + POSTGRES_PASSWORD: ${PG_PASSWORD} + POSTGRES_DB: ${PG_DB} + PGDATABASE: ${PG_DB} + PGPASSWORD: ${PG_PASSWORD} + PGUSER: ${PG_USER} + ports: + - ${DB_PORT}:5432 + pgadmin4: + container_name: forum_pgadmin4 + image: dpage/pgadmin4 + restart: always + environment: + PGADMIN_DEFAULT_EMAIL: admin@admin.com # your email to login at http://localhost:5050/ + PGADMIN_DEFAULT_PASSWORD: 1 # your password to login at http://localhost:5050/ + ports: + - "5050:80" + volumes: + - pgadmin-data:/var/lib/pgadmin/data +volumes: + db_data: + pgadmin-data: diff --git a/sample.env b/sample.env index d42fcc1..f11d28d 100644 --- a/sample.env +++ b/sample.env @@ -1,18 +1,18 @@ #db details -SECRET_KEY= -PG_DB= -PG_USER= -PG_PASSWORD= -DB_HOST= -DB_PORT= +SECRET_KEY= 1111 +PG_DB= Forum-Sandbox +PG_USER= user +PG_PASSWORD= postgres +DB_HOST= db +DB_PORT= 5432 #SMTP EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend -EMAIL_HOST= -EMAIL_PORT= -EMAIL_USE_TLS= -EMAIL_HOST_USER= -EMAIL_HOST_PASSWORD= +EMAIL_HOST= someuser@gmail.com +EMAIL_PORT= 587 +EMAIL_USE_TLS= 1 +EMAIL_HOST_USER= test@test.com +EMAIL_HOST_PASSWORD= test-password #origin hostnames allowed to make cross-site HTTP requests CORS_ORIGIN_WHITELIST=