Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker deployment of the app #10

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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