From 402d0415db28cb3bf725c098a25795af04d4fd7d Mon Sep 17 00:00:00 2001 From: Theo Pack Date: Sat, 6 Oct 2018 20:12:54 +0200 Subject: [PATCH] Add docker compose file with PostgreSQL included --- README.md | 9 +++++++++ docker-compose.yml | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index d9fb967..43574ee 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,15 @@ docker run -it --env DBPASS="" --env DBHOST="" --env ``` The app can be reached in your browser at `http://127.0.0.1:5000`. +## Docker compose with PostgreSQL + +You also can use the docker compose file to spin up the Python Flask application and a PostgreSQL docker container. The database connection information will be passed automatically within the docker compose file. + +``` +docker-compose build +docker-compose up +``` + # Contributing This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d9e4a41 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3' +services: + flask-sample: + build: . + depends_on: + - db + ports: + - "5000:5000" + environment: + - DBUSER=postgres + - DBPASS=changeme + - DBHOST=db + - DBNAME=postgres + db: + image: postgres:10 + restart: always + environment: + POSTGRES_PASSWORD: changeme