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

Added support for docker to ease the process of deployment #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.9

WORKDIR /app

COPY . /app

RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 5000

ENV FLASK_APP=application.py
ENV FLASK_DEBUG=1
ENV API_KEY=MY_API_KEY

CMD ["python", "-m", "flask", "run"]
2 changes: 1 addition & 1 deletion application.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


# Set the API KEY of Javascript Maps API
if not os.environ.get("API_KEY"):
if not os.environ.get("API_KEY") or os.environ.get("API_KEY")=="MY_API_KEY":
raise RuntimeError("API_KEY not set")


Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3'

services:
myapp:
image: python:3.9
working_dir: /app
volumes:
- .:/app
command: sh -c "pip install --no-cache-dir -r requirements.txt && python -m flask run"
environment:
- FLASK_APP=application.py
- FLASK_DEBUG=1
- API_KEY=MY_API_KEY
ports:
- "5000:5000"