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