Skip to content

Commit 15902a6

Browse files
committed
all the dockerfile gubbins
1 parent fda077d commit 15902a6

File tree

4 files changed

+59
-3
lines changed

4 files changed

+59
-3
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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

Makefile

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
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+
119
test:
220
pytest --tb=short
321

4-
watch-tests:
5-
ls *.py | entr pytest --tb=short
6-
722
black:
823
black -l 86 $$(find * -name '*.py')

docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pytest
2+
sqlalchemy
3+
flask
4+
psycopg2-binary
5+
requests

0 commit comments

Comments
 (0)