Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -3
Dockerfile
CHANGED
|
@@ -1,12 +1,25 @@
|
|
| 1 |
-
#
|
| 2 |
FROM python:3.11-bookworm AS builder
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
COPY requirements.txt .
|
| 5 |
-
RUN pip install --prefix=/install -r requirements.txt
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
FROM mcr.microsoft.com/playwright/python:v1.42.0-jammy
|
|
|
|
| 9 |
WORKDIR /app
|
|
|
|
|
|
|
| 10 |
COPY --from=builder /install /usr/local
|
|
|
|
| 11 |
COPY app app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
CMD ["python", "app/main.py"]
|
|
|
|
| 1 |
+
# Stage 1: Build
|
| 2 |
FROM python:3.11-bookworm AS builder
|
| 3 |
+
|
| 4 |
WORKDIR /app
|
| 5 |
COPY requirements.txt .
|
| 6 |
+
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
| 7 |
+
|
| 8 |
+
COPY app app
|
| 9 |
|
| 10 |
+
# Stage 2: Production
|
| 11 |
FROM mcr.microsoft.com/playwright/python:v1.42.0-jammy
|
| 12 |
+
|
| 13 |
WORKDIR /app
|
| 14 |
+
|
| 15 |
+
# Copy installed modules correctly
|
| 16 |
COPY --from=builder /install /usr/local
|
| 17 |
+
|
| 18 |
COPY app app
|
| 19 |
+
|
| 20 |
+
RUN useradd --home-dir /app --shell /bin/sh zaws && \
|
| 21 |
+
chown -R zaws:zaws /app
|
| 22 |
+
|
| 23 |
+
USER zaws
|
| 24 |
+
|
| 25 |
CMD ["python", "app/main.py"]
|