formkro / Dockerfile
triflix's picture
Update Dockerfile
5ce0383 verified
raw
history blame contribute delete
899 Bytes
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"]