Skip to content

Commit

Permalink
Add Dockerfile and docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
mandrews committed Jan 10, 2020
1 parent 855ee8a commit 1b12d56
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .env
@@ -0,0 +1,7 @@
FLASK_APP=application
FLASK_ENV=dev
FLASK_RUN_HOST=0.0.0.0
MAIL_DEBUG=true

jwt_secret_key='XulhzbydxgvwRkPXnDeCoOw2VrE='
secret_key='H78Pg7CalkDlf4A81YKDlKcax8c='
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -16,7 +16,6 @@ library
# Python
__pycache__
venv
.env
*.pyc

# Database
Expand All @@ -31,4 +30,4 @@ src/migrations
# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
!.elasticbeanstalk/*.global.yml
29 changes: 29 additions & 0 deletions Dockerfile
@@ -0,0 +1,29 @@
FROM python:3.5-alpine

RUN apk update && \
apk add --no-cache \
gcc \
musl-dev \
npm \
postgresql-dev \
python3-dev

WORKDIR /app

COPY requirements.txt requirements.txt

RUN pip install --upgrade pip && \
pip install --requirement requirements.txt

COPY package.json package.json

RUN npm install --global npm && \
npm update && \
npm install && \
npm run dev

COPY . /app

ENTRYPOINT [ "./entrypoint.sh" ]

CMD [ "run" ]
24 changes: 24 additions & 0 deletions docker-compose.yaml
@@ -0,0 +1,24 @@
version: '3.7'

services:
db:
image: postgres:12.0-alpine
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: dev
volumes:
- postgres_data:/var/lib/postgresql/data/

app:
build: .
depends_on:
- db
environment:
- db_url=postgres://postgres:password@db:5432/dev
ports:
- 5000:5000
volumes:
- .:/app

volumes:
postgres_data:
4 changes: 4 additions & 0 deletions entrypoint.sh
@@ -0,0 +1,4 @@
#!/bin/sh
CMD=${1:-run}
flask db upgrade
flask "${CMD}"

0 comments on commit 1b12d56

Please sign in to comment.