AstraOS commited on
Commit
08c6af5
·
verified ·
1 Parent(s): 7dd172d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +2 -25
Dockerfile CHANGED
@@ -1,31 +1,8 @@
1
- ######################## builder stage ########################
2
- FROM python:3.9-slim AS builder
3
- WORKDIR /build
4
-
5
- # --- install dependencies into /install ---
6
- COPY requirements.txt .
7
- RUN pip install --prefix=/install --no-cache-dir -r requirements.txt
8
-
9
- # --- copy source and compile to byte-code ---
10
- COPY app.py .
11
- RUN python -m compileall -b -f app.py # produces /build/app.pyc
12
-
13
- # --- pack the .pyc into a gzip tarball ---
14
- RUN tar -C /build -czf /build/app.tgz app.pyc
15
-
16
- ######################## runtime stage ########################
17
  FROM python:3.9-slim
18
  WORKDIR /app
19
-
20
- # 1) bring in site-packages from builder
21
- COPY --from=builder /install /usr/local/
22
-
23
- # 2) bring in the compressed payload only
24
- COPY --from=builder /build/app.tgz ./app.tgz
25
-
26
- # 3) entry-point that unpacks → runs → deletes
27
  COPY entrypoint.sh /entrypoint.sh
28
  RUN chmod +x /entrypoint.sh
29
-
30
  EXPOSE 7860
31
  ENTRYPOINT ["/entrypoint.sh"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM python:3.9-slim
2
  WORKDIR /app
3
+ # deps only
4
+ COPY --from=builder /install /usr/local
 
 
 
 
 
 
5
  COPY entrypoint.sh /entrypoint.sh
6
  RUN chmod +x /entrypoint.sh
 
7
  EXPOSE 7860
8
  ENTRYPOINT ["/entrypoint.sh"]