Update Dockerfile
Browse files- Dockerfile +24 -1
Dockerfile
CHANGED
|
@@ -1,7 +1,30 @@
|
|
| 1 |
FROM python:3.10-slim
|
|
|
|
|
|
|
| 2 |
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
COPY requirements.txt .
|
| 4 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
| 5 |
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
EXPOSE 7860
|
| 7 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# 1. System deps & working dir
|
| 4 |
WORKDIR /app
|
| 5 |
+
RUN apt-get update \
|
| 6 |
+
&& apt-get install -y --no-install-recommends \
|
| 7 |
+
build-essential \
|
| 8 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
+
# 2. Pre-create data dirs with correct ownership
|
| 11 |
+
# - /app/data used at build to satisfy app.py
|
| 12 |
+
# - /mnt/data for persistent storage across space rebuilds
|
| 13 |
+
RUN mkdir -p /app/data/forms /app/data/submissions \
|
| 14 |
+
&& mkdir -p /mnt/data/forms /mnt/data/submissions \
|
| 15 |
+
&& chown -R root:root /app/data \
|
| 16 |
+
&& chown -R root:root /mnt/data
|
| 17 |
+
|
| 18 |
+
# 3. Copy and install Python dependencies
|
| 19 |
COPY requirements.txt .
|
| 20 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
+
|
| 22 |
+
# 4. Copy the rest of your app
|
| 23 |
COPY . .
|
| 24 |
+
|
| 25 |
+
# 5. Environment variable tells app to write under /mnt/data
|
| 26 |
+
ENV DATA_DIR=/mnt/data
|
| 27 |
+
|
| 28 |
+
# 6. Expose the port and launch
|
| 29 |
EXPOSE 7860
|
| 30 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|