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 4
4
5
5
services :
6
6
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
10
10
depends_on :
11
11
redis :
12
12
condition : service_healthy
@@ -17,7 +17,7 @@ services:
17
17
retries : 3
18
18
start_period : 10s
19
19
volumes :
20
- - ./vote:/app
20
+ - ./vote:/usr/local/ app
21
21
ports :
22
22
- " 5000:80"
23
23
networks :
@@ -32,7 +32,7 @@ services:
32
32
db :
33
33
condition : service_healthy
34
34
volumes :
35
- - ./result:/app
35
+ - ./result:/usr/local/ app
36
36
ports :
37
37
- " 5001:80"
38
38
- " 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
3
3
4
- # add curl for healthcheck
4
+ # Add curl for healthcheck
5
5
RUN apt-get update && \
6
6
apt-get install -y --no-install-recommends curl && \
7
7
rm -rf /var/lib/apt/lists/*
@@ -13,6 +13,16 @@ WORKDIR /usr/local/app
13
13
COPY requirements.txt ./requirements.txt
14
14
RUN pip install --no-cache-dir -r requirements.txt
15
15
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
+
16
26
# Copy our code from the current folder to the working directory inside the container
17
27
COPY . .
18
28
You can’t perform that action at this time.
0 commit comments