diff --git a/src/docker-compose.yml b/src/docker-compose.yml index b654c4d63..2830e628a 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -2,8 +2,10 @@ version: "3.0" services: app: build: . + depends_on: + - db volumes: - - ./app:/app + - .:/app links: - db working_dir: /app @@ -13,19 +15,22 @@ services: condition: on-failure max_attempts: 5 environment: - # Ensure stdout and stderr are sent straight to the terminal without buffering + # Send stdout and stderr straight to the terminal without buffering - PYTHONUNBUFFERED=yup - # In case we'd like to know - - RUNNING_IN_DOCKER=yup # How to connect to Postgre container - DATABASE_URL=postgres://user:feedabee@db/app - # Run in development mode on our local - - DJANGO_SETTINGS_MODULE=app.settings.dev + # Tell Django where to find its configuration + - DJANGO_SETTINGS_MODULE=registrar.config.settings + # Set a local key for Django + - DJANGO_SECRET_KEY=feedabee + # Run Django in debug mode on local + - DJANGO_DEBUG=True stdin_open: true tty: true ports: - - "8000:8000" - command: "python" + - "8080:8000" + # command: "python" + command: "python manage.py runserver 0.0.0.0:8000" db: image: postgres:latest diff --git a/src/app/docker_entrypoint.py b/src/docker_entrypoint.py similarity index 92% rename from src/app/docker_entrypoint.py rename to src/docker_entrypoint.py index ea0af5ebe..ca9431b70 100644 --- a/src/app/docker_entrypoint.py +++ b/src/docker_entrypoint.py @@ -11,7 +11,7 @@ container are also owned by the same user on the host system. import sys import os import pwd -import subprocess # nosec +import subprocess HOST_UID = os.stat("/app").st_uid HOST_USER = "james" @@ -41,7 +41,7 @@ if __name__ == "__main__": username += "0" home_dir = "/home/%s" % username subprocess.check_call( - [ # nosec + [ "useradd", "-d", home_dir, @@ -53,4 +53,4 @@ if __name__ == "__main__": ) os.environ["HOME"] = "/home/%s" % pwd.getpwuid(HOST_UID).pw_name os.setuid(HOST_UID) - os.execvp(sys.argv[1], sys.argv[1:]) # nosec + os.execvp(sys.argv[1], sys.argv[1:])