File tree Expand file tree Collapse file tree 4 files changed +59
-3
lines changed
Expand file tree Collapse file tree 4 files changed +59
-3
lines changed Original file line number Diff line number Diff line change 1+ FROM python:3.9-slim-buster
2+
3+ COPY requirements.txt /tmp
4+ RUN pip install -r /tmp/requirements.txt
5+
6+ RUN mkdir -p /code
7+ COPY *.py /code/
8+ WORKDIR /code
9+ ENV FLASK_APP=flask_app.py FLASK_DEBUG=1 PYTHONUNBUFFERED=1
10+ CMD flask run --host=0.0.0.0 --port=80
Original file line number Diff line number Diff line change 1+ # these will speed up builds, for docker-compose >= 1.25
2+ export COMPOSE_DOCKER_CLI_BUILD =1
3+ export DOCKER_BUILDKIT =1
4+
5+ all : down build up test
6+
7+ build :
8+ docker-compose build
9+
10+ up :
11+ docker-compose up -d app
12+
13+ down :
14+ docker-compose down
15+
16+ logs :
17+ docker-compose logs app | tail -100
18+
119test :
220 pytest --tb=short
321
4- watch-tests :
5- ls * .py | entr pytest --tb=short
6-
722black :
823 black -l 86 $$(find * -name '*.py' )
Original file line number Diff line number Diff line change 1+ version : " 3"
2+ services :
3+
4+ app :
5+ build :
6+ context : .
7+ dockerfile : Dockerfile
8+ depends_on :
9+ - postgres
10+ environment :
11+ - DB_HOST=postgres
12+ - DB_PASSWORD=abc123
13+ volumes :
14+ - ./:/code
15+ ports :
16+ - " 5005:80"
17+
18+
19+ postgres :
20+ image : postgres:9.6
21+ environment :
22+ - POSTGRES_USER=allocation
23+ - POSTGRES_PASSWORD=abc123
24+ ports :
25+ - " 54321:5432"
26+
Original file line number Diff line number Diff line change 1+ pytest
2+ sqlalchemy
3+ flask
4+ psycopg2-binary
5+ requests
You can’t perform that action at this time.
0 commit comments