Skip to content

Commit

Permalink
docker
Browse files Browse the repository at this point in the history
  • Loading branch information
dom-inic committed Mar 28, 2024
1 parent 789500d commit 8c5c457
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ celerybeat.pid

# Environments
.env
.env.dev
.venv
env/
venv/
Expand Down
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The first instruction is what image we want to base our container on
# We Use an official Python runtime as a parent image
FROM python:3.9.6
FROM python:3.11.4-slim-buster

# The enviroment variable ensures that the python output is set straight
# to the terminal with out buffering it first
Expand All @@ -18,11 +18,8 @@ WORKDIR /conshareapi3.0
ADD . /conshareapi3.0/

# Allows docker to cache installed dependencies between builds
RUN pip install --upgrade pip
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 8000
# start server
CMD python manage.py runserver


7 changes: 0 additions & 7 deletions conshareapi/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'dp4#6elyt3ecr)quo6di2a)!bhrv)mdf*b&n7cj82t6gwo&yy9'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['127.0.0.1', 'conshareapi.herokuapp.com', '0.0.0.0']


Expand Down
3 changes: 3 additions & 0 deletions conshareapi/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import os
# override base.py settings

DEBUG = bool(os.environ.get("DEBUG", default=0))
SECRET_KEY = os.environ.get("SECRET_KEY")

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


Expand Down
3 changes: 2 additions & 1 deletion conshareapi/settings/prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

SECRET_KEY = os.environ.get('SECRET_KEY')
DEBUG = bool(os.environ.get("DEBUG", default=0))
SECRET_KEY = os.environ.get("SECRET_KEY")

import os

Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ services:
- "8000:8000"
command: bash -c "python manage.py makemigrations && python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/conshareapi3.0
- .:/conshareapi3.0
env_file:
- ./.env.dev

0 comments on commit 8c5c457

Please sign in to comment.