Skip to content

Commit

Permalink
Merge pull request #10 from benji011/dockerize-app
Browse files Browse the repository at this point in the history
Docker deployment of the app
  • Loading branch information
DiptoChakrabarty authored Oct 4, 2020
2 parents 43b9652 + e960eba commit 35a8c5b
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.8

ENV FLASK_APP=app.py

ENV FLASK_RUN_HOST=0.0.0.0

WORKDIR /app

COPY . .

# Install packages
RUN pip3 install -r requirements.txt

RUN rm site.db

EXPOSE 5000

CMD ["python3", "app.py"]
5 changes: 5 additions & 0 deletions database.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
POSTGRES_USER=test
POSTGRES_PASSWORD=password
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=flask_online_store
27 changes: 27 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3.8'
services:
db:
image: postgres:latest
env_file: database.conf
ports:
- 5432:5432
volumes:
- ./db_volume:/var/lib/db
app:
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
volumes:
- ./:/app
environment:
FLASK_ENV: development
FLASK_APP: ./app.py
ports:
- 5000:5000
restart: always
depends_on:
- db
volumes:
data-volume:
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ MarkupSafe==1.1.1
marshmallow==3.7.1
marshmallow-sqlalchemy==0.23.1
oauthlib==2.1.0
pkg-resources==0.0.0
pycparser==2.20
PyJWT==1.6.4
python-dateutil==2.8.1
Expand Down

0 comments on commit 35a8c5b

Please sign in to comment.