File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 44
55services :
66 vote :
7- build : ./vote
8- # use python rather than gunicorn for local dev
9- command : python app.py
7+ build :
8+ context : ./vote
9+ target : dev
1010 depends_on :
1111 redis :
1212 condition : service_healthy
@@ -17,7 +17,7 @@ services:
1717 retries : 3
1818 start_period : 10s
1919 volumes :
20- - ./vote:/app
20+ - ./vote:/usr/local/ app
2121 ports :
2222 - " 5000:80"
2323 networks :
@@ -32,7 +32,7 @@ services:
3232 db :
3333 condition : service_healthy
3434 volumes :
35- - ./result:/app
35+ - ./result:/usr/local/ app
3636 ports :
3737 - " 5001:80"
3838 - " 127.0.0.1:9229:9229"
Original file line number Diff line number Diff line change 1- # Using official python runtime base image
2- FROM python:3.11-slim
1+ # Define a base stage that uses the official python runtime base image
2+ FROM python:3.11-slim AS base
33
4- # add curl for healthcheck
4+ # Add curl for healthcheck
55RUN apt-get update && \
66 apt-get install -y --no-install-recommends curl && \
77 rm -rf /var/lib/apt/lists/*
@@ -13,6 +13,16 @@ WORKDIR /usr/local/app
1313COPY requirements.txt ./requirements.txt
1414RUN pip install --no-cache-dir -r requirements.txt
1515
16+ # Define a stage specifically for development, where it'll watch for
17+ # filesystem changes
18+ FROM base AS dev
19+ RUN pip install watchdog
20+ ENV FLASK_ENV=development
21+ CMD ["python" , "app.py" ]
22+
23+ # Define the final stage that will bundle the application for production
24+ FROM base AS final
25+
1626# Copy our code from the current folder to the working directory inside the container
1727COPY . .
1828
You can’t perform that action at this time.
0 commit comments