Commit d304800e authored by Jon Yu's avatar Jon Yu
Browse files

Initial commit for PostgreSQL bits

parent bcf4925e
...@@ -3,13 +3,25 @@ version: '3' ...@@ -3,13 +3,25 @@ version: '3'
services: services:
app: app:
build: build:
context: . context: ./app
args: args:
ENVIRONMENT: DEVELOPMENT ENVIRONMENT: DEVELOPMENT
env_file: .env env_file: ./app/.env
ports: ports:
- 127.0.0.1:8000:8000 - 127.0.0.1:8000:8000
volumes: volumes:
- .:/usr/src/app - ./app:/usr/src/app
entrypoint: ../docker-entrypoint.sh entrypoint: ./docker-entrypoint.sh
command: "python3 manage.py runserver 0.0.0.0:8000 --nostatic" command: "python3 manage.py runserver 0.0.0.0:8000 --nostatic"
depends_on:
- db
db:
image: postgres:12-alpine
env_file:
- ./db/.env
ports:
- 5432:5432
volumes:
- postgres-data:/var/lib/pgsql/data
volumes:
postgres-data:
...@@ -14,6 +14,7 @@ if [ "$#" -ne 2 ]; then ...@@ -14,6 +14,7 @@ if [ "$#" -ne 2 ]; then
echo "Usage: $1 Project Output Path; $2 Project Name" >&2 echo "Usage: $1 Project Output Path; $2 Project Name" >&2
exit 1 exit 1
fi fi
if ! [ -d "$1" ]; then if ! [ -d "$1" ]; then
echo "$1 not a directory" >&2 echo "$1 not a directory" >&2
exit 1 exit 1
...@@ -21,6 +22,6 @@ fi ...@@ -21,6 +22,6 @@ fi
trap clean_up EXIT trap clean_up EXIT
docker build -t $IMAGE_TAG . docker build -t $IMAGE_TAG ./app
docker run --rm -d -t -v "$1":"$CONTAINER_PROJECT_DIR":z --name $CONTAINER_NAME --entrypoint /bin/bash $IMAGE_TAG docker run --rm -d -t -v "$1":"$CONTAINER_PROJECT_DIR":z --name $CONTAINER_NAME --entrypoint /bin/bash $IMAGE_TAG
docker exec -it $CONTAINER_NAME django-admin startproject --template ./ "$2" "$CONTAINER_PROJECT_DIR" docker exec -it $CONTAINER_NAME django-admin startproject --template ./ "$2" "$CONTAINER_PROJECT_DIR"
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment