Commit
·
44bd464
1
Parent(s):
862eff1
update: dockerfile
Browse files- Dockerfile +3 -30
Dockerfile
CHANGED
|
@@ -2,7 +2,6 @@ FROM python:3.12-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
curl \
|
|
@@ -11,39 +10,13 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
wget \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
# Create a non-root user
|
| 15 |
-
RUN groupadd --gid 1000 appuser && \
|
| 16 |
-
useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash appuser
|
| 17 |
-
|
| 18 |
-
# Set UV environment variables to use writable cache locations
|
| 19 |
-
ENV UV_CACHE_DIR=/tmp/uv-cache
|
| 20 |
-
ENV UV_TOOL_DIR=/tmp/uv-tools
|
| 21 |
-
ENV UV_PYTHON_INSTALL_DIR=/tmp/uv-python
|
| 22 |
-
|
| 23 |
-
# Install UV
|
| 24 |
-
RUN pip3 install uv
|
| 25 |
-
|
| 26 |
-
# Create cache directories with proper permissions
|
| 27 |
-
RUN mkdir -p /tmp/uv-cache /tmp/uv-tools /tmp/uv-python && \
|
| 28 |
-
chown -R appuser:appuser /tmp/uv-cache /tmp/uv-tools /tmp/uv-python
|
| 29 |
-
|
| 30 |
-
# Copy requirements first for better Docker layer caching
|
| 31 |
COPY requirements.txt ./
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
USER appuser
|
| 35 |
-
|
| 36 |
-
# Create virtual environment and install dependencies
|
| 37 |
-
RUN uv venv /home/appuser/.venv
|
| 38 |
-
RUN source /home/appuser/.venv/bin/activate
|
| 39 |
-
RUN uv pip install -r requirements.txt
|
| 40 |
-
|
| 41 |
-
# Copy application code
|
| 42 |
-
COPY --chown=appuser:appuser src/ ./src/
|
| 43 |
|
| 44 |
EXPOSE 8501
|
| 45 |
|
| 46 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 47 |
|
| 48 |
-
|
| 49 |
-
ENTRYPOINT ["/home/appuser/.venv/bin/python", "-m", "streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
build-essential \
|
| 7 |
curl \
|
|
|
|
| 10 |
wget \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
COPY requirements.txt ./
|
| 14 |
+
COPY src/ ./src/
|
| 15 |
|
| 16 |
+
RUN pip3 install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
EXPOSE 8501
|
| 19 |
|
| 20 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 21 |
|
| 22 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|