Spaces:
Sleeping
Sleeping
Vikram Vasudevan commited on
Commit ·
3d1b0b5
1
Parent(s): 837ff42
added docker file for HF
Browse files- Dockerfile +37 -0
Dockerfile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV PYTHONUNBUFFERED=1 \
|
| 6 |
+
PYTHONDONTWRITEBYTECODE=1 \
|
| 7 |
+
PIP_NO_CACHE_DIR=1 \
|
| 8 |
+
GRADIO_ALLOW_FLAGGING=never \
|
| 9 |
+
HOME=/home/user \
|
| 10 |
+
PATH=/home/user/.local/bin:$PATH
|
| 11 |
+
|
| 12 |
+
# Install system dependencies
|
| 13 |
+
RUN apt-get update && apt-get install -y \
|
| 14 |
+
build-essential \
|
| 15 |
+
python3-dev \
|
| 16 |
+
cmake \
|
| 17 |
+
git \
|
| 18 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
+
|
| 20 |
+
# Create a non-root user
|
| 21 |
+
RUN useradd -m -u 1000 user
|
| 22 |
+
USER user
|
| 23 |
+
WORKDIR $HOME/app
|
| 24 |
+
|
| 25 |
+
# Copy requirements and install
|
| 26 |
+
COPY --chown=user requirements.txt .
|
| 27 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 28 |
+
|
| 29 |
+
# Copy the rest of the application
|
| 30 |
+
COPY --chown=user . .
|
| 31 |
+
|
| 32 |
+
# Expose the port Streamlit runs on
|
| 33 |
+
EXPOSE 7860
|
| 34 |
+
|
| 35 |
+
# Command to run the application
|
| 36 |
+
# Hugging Face Spaces expect the app to run on port 7860
|
| 37 |
+
CMD ["streamlit", "run", "src/god_sim/app/streamlit_app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
|