Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +8 -4
Dockerfile
CHANGED
@@ -5,9 +5,13 @@ WORKDIR /build
|
|
5 |
COPY requirements.txt .
|
6 |
RUN pip install --prefix=/install -r requirements.txt
|
7 |
|
8 |
-
COPY app.py .
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
|
12 |
################ runtime ################
|
13 |
FROM python:3.9-slim
|
@@ -28,5 +32,5 @@ ENTRYPOINT ["bash", "-c", "\
|
|
28 |
tar -xzf /tmp/runner/app.tgz -C /tmp/runner; \
|
29 |
python /tmp/runner/app.pyc & pid=$!; \
|
30 |
sleep 2; \
|
31 |
-
rm -f /tmp/runner/app.pyc /tmp/runner/app.tgz; \
|
32 |
wait $pid"]
|
|
|
5 |
COPY requirements.txt .
|
6 |
RUN pip install --prefix=/install -r requirements.txt
|
7 |
|
8 |
+
COPY app.py telegram_preview.py ./
|
9 |
+
|
10 |
+
# compile both files
|
11 |
+
RUN python -m compileall -b -f app.py telegram_preview.py # → app.pyc
|
12 |
+
|
13 |
+
# bundle both .pyc files together
|
14 |
+
RUN tar -czf /build/app.tgz app.pyc telegram_preview.pyc # bundle
|
15 |
|
16 |
################ runtime ################
|
17 |
FROM python:3.9-slim
|
|
|
32 |
tar -xzf /tmp/runner/app.tgz -C /tmp/runner; \
|
33 |
python /tmp/runner/app.pyc & pid=$!; \
|
34 |
sleep 2; \
|
35 |
+
rm -f /tmp/runner/app.pyc /tmp/runner/telegram_preview.pyc /tmp/runner/app.tgz; \
|
36 |
wait $pid"]
|