mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-16 17:47:02 +02:00
Edit Docker files
- Moving folders around - Setting up docker-compose for Django
This commit is contained in:
parent
4856e28290
commit
3c725ce1ac
2 changed files with 16 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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:])
|
Loading…
Add table
Add a link
Reference in a new issue