Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +3 -10
Dockerfile
CHANGED
@@ -1,25 +1,18 @@
|
|
1 |
-
|
2 |
FROM python:3.9-slim AS builder
|
3 |
WORKDIR /build
|
4 |
-
|
5 |
COPY requirements.txt .
|
6 |
RUN pip install --prefix=/install -r requirements.txt
|
7 |
-
|
8 |
COPY app.py .
|
9 |
RUN python -m compileall -b -f app.py
|
10 |
RUN tar -C /build -czf /build/app.tgz app.pyc
|
11 |
|
12 |
-
|
13 |
FROM python:3.9-slim
|
14 |
WORKDIR /app
|
15 |
-
|
16 |
-
# 1. Install dependencies
|
17 |
COPY --from=builder /install /usr/local/
|
|
|
18 |
|
19 |
-
# 2. Copy the bytecode tarball into writable /tmp
|
20 |
-
COPY --from=builder /build/app.tgz /tmp/app.tgz
|
21 |
-
|
22 |
-
# 3. Add entrypoint
|
23 |
COPY entrypoint.sh /entrypoint.sh
|
24 |
RUN chmod +x /entrypoint.sh
|
25 |
|
|
|
1 |
+
################ builder ################
|
2 |
FROM python:3.9-slim AS builder
|
3 |
WORKDIR /build
|
|
|
4 |
COPY requirements.txt .
|
5 |
RUN pip install --prefix=/install -r requirements.txt
|
|
|
6 |
COPY app.py .
|
7 |
RUN python -m compileall -b -f app.py
|
8 |
RUN tar -C /build -czf /build/app.tgz app.pyc
|
9 |
|
10 |
+
################ runtime ################
|
11 |
FROM python:3.9-slim
|
12 |
WORKDIR /app
|
|
|
|
|
13 |
COPY --from=builder /install /usr/local/
|
14 |
+
COPY --from=builder /build/app.tgz /app/app.tgz
|
15 |
|
|
|
|
|
|
|
|
|
16 |
COPY entrypoint.sh /entrypoint.sh
|
17 |
RUN chmod +x /entrypoint.sh
|
18 |
|