Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker-compose file #4

Merged
merged 3 commits into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DEBUG=true
SECRET_KEY=keyboard-mash
DATABASE_URL=postgres://postgres:postgres@db/consvc_shepherd
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@ $ ./manage.py runserver
This will start a development server that reloads on changes to the files. You
can access the configuration part of the site at
[localhost:8000/admin][http://localhost:8000/admin].

### Docker set up

Start with building and get it up with:
```
docker compose build
docker compose up
```
To create a user, shell into the container and run
```
./manage.py createsuperuser
```
45 changes: 45 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: "3"

services:
db:
restart: always
image: postgres:14.0
volumes:
- db_volume:/var/lib/postgresql
environment:
POSTGRES_DB: consvc_shepherd
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- "5432:5432"
networks:
- private_nw

app:
tty: true
env_file:
- .env
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file missing?

Copy link
Contributor Author

@tiftran tiftran Mar 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes i should probably have a .env.example

build:
context: ./
dockerfile: ./Dockerfile
command: bash -c "python /app/manage.py migrate && python /app/manage.py runserver 0:8000"
links:
- db
networks:
- public_nw
- private_nw
volumes:
- .:/app
ports:
- "8000:8000"
depends_on:
- db

volumes:
db_volume:
node_modules_volume:
ssl_volume:

networks:
private_nw:
internal: true
public_nw:
3 changes: 2 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ flake8
mypy
django-environ
django-storages[google]
django-countries
django-countries
psycopg2
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ protobuf==3.19.4
# google-api-core
# google-cloud-storage
# googleapis-common-protos
psycopg2==2.9.3
# via -r requirements.in
pyasn1==0.4.8
# via
# pyasn1-modules
Expand Down