AstraOS commited on
Commit
36d3d34
·
verified ·
1 Parent(s): 17783cf

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -5
Dockerfile CHANGED
@@ -6,12 +6,14 @@ 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
@@ -27,10 +29,10 @@ EXPOSE 7860
27
  # -------- no file, all inline --------
28
  ENTRYPOINT ["bash", "-c", "\
29
  set -euo pipefail; \
30
- mkdir -p /tmp/runner; \
31
  cp /app/app.tgz /tmp/runner/; \
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"]
 
6
  RUN pip install --prefix=/install -r requirements.txt
7
 
8
  COPY app.py telegram_preview.py ./
9
+ COPY templates/ templates/ # include HTML templates
10
 
11
  # compile both files
12
+ RUN python -m compileall -b -f app.py telegram_preview.py
13
 
14
+ # bundle everything needed
15
+ RUN tar -czf /build/app.tgz \
16
+ app.pyc telegram_preview.pyc templates/preview.html
17
 
18
  ################ runtime ################
19
  FROM python:3.9-slim
 
29
  # -------- no file, all inline --------
30
  ENTRYPOINT ["bash", "-c", "\
31
  set -euo pipefail; \
32
+ mkdir -p /tmp/runner/templates; \
33
  cp /app/app.tgz /tmp/runner/; \
34
  tar -xzf /tmp/runner/app.tgz -C /tmp/runner; \
35
  python /tmp/runner/app.pyc & pid=$!; \
36
  sleep 2; \
37
  rm -f /tmp/runner/app.pyc /tmp/runner/telegram_preview.pyc /tmp/runner/app.tgz; \
38
+ wait $pid"]