For use in conjunction with https://github.com/accent-starlette/boilerplate.
Example Dockerfile
:
ARG EXTRA_DEPS
ARG EXTRA_BUILD_DEPS
ARG REQUIREMENTS_FILE=/requirements/base.txt
FROM accent/starlette-docker:3.8-alpine
ENV APP_MODULE=app.main:app \
ALLOWED_HOSTS="*" \
DATABASE_URL=postgresql+psycopg2://postgres:password@db:5432/appdb \
SECRET_KEY="***** change me *****" \
EMAIL_HOST=mail \
EMAIL_PORT=1025 \
[email protected] \
EMAIL_DEFAULT_FROM_NAME=Mail
Example docker-compose.yml
:
version: '2'
services:
app:
build:
context: .
args:
- REQUIREMENTS_FILE=/requirements/dev.txt
environment:
- DATABASE_URL=postgresql+psycopg2://postgres:password@db:5432/appdb
- DEBUG=True
volumes:
- ./src:/app
depends_on:
- db
ports:
- "80:80"
command: ['/start-reload.sh']
db:
image: postgres:9.6
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=appdb
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- ./.postgres:/var/lib/postgresql/data/pgdata
ports:
- "5432:5432"