API: Dockerfile init
This commit is contained in:
parent
a8faabddc3
commit
279fb9bbea
31
docker-compose.yml
Normal file
31
docker-compose.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
version: '3.3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
db:
|
||||||
|
container_name: db
|
||||||
|
build:
|
||||||
|
context: ./mpwo_api/db
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- 5435:5432
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=mpwo
|
||||||
|
- POSTGRES_PASSWORD=mpwo
|
||||||
|
|
||||||
|
api:
|
||||||
|
container_name: api
|
||||||
|
build:
|
||||||
|
context: ./mpwo_api
|
||||||
|
dockerfile: Dockerfile-dev
|
||||||
|
ports:
|
||||||
|
- 5001:5000
|
||||||
|
environment:
|
||||||
|
- FLASK_APP=server.py
|
||||||
|
- FLASK_DEBUG=1
|
||||||
|
- APP_SETTINGS=mpwo_api.config.DevelopmentConfig
|
||||||
|
- DATABASE_URL=postgres://mpwo:mpwo@db:5432/mpwo
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
links:
|
||||||
|
- db
|
17
mpwo_api/Dockerfile-dev
Normal file
17
mpwo_api/Dockerfile-dev
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
FROM python:3.6.3
|
||||||
|
|
||||||
|
# set working directory
|
||||||
|
RUN mkdir -p /usr/src/app
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# add requirements
|
||||||
|
ADD ./requirements.txt /usr/src/app/mpwo_api/requirements.txt
|
||||||
|
|
||||||
|
# install requirements
|
||||||
|
RUN pip install -r mpwo_api/requirements.txt
|
||||||
|
|
||||||
|
# add app
|
||||||
|
ADD . /usr/src/app
|
||||||
|
|
||||||
|
# run server
|
||||||
|
CMD flask run --with-threads -h 0.0.0.0
|
3
mpwo_api/db/Dockerfile
Normal file
3
mpwo_api/db/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM postgres
|
||||||
|
|
||||||
|
ADD mpwo.sql /docker-entrypoint-initdb.d
|
Loading…
Reference in New Issue
Block a user