Update Dockerfile
Browse files- Dockerfile +11 -0
Dockerfile
CHANGED
|
@@ -35,13 +35,24 @@ RUN apt-get update && apt-get install -y \
|
|
| 35 |
chromium-driver \
|
| 36 |
&& rm -rf /var/lib/apt/lists/*
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
# Install Python dependencies
|
| 39 |
COPY requirements.txt /tmp/requirements.txt
|
| 40 |
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 41 |
|
| 42 |
# Copy app code
|
| 43 |
COPY . /app
|
|
|
|
|
|
|
| 44 |
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
# Expose Streamlit port
|
| 47 |
EXPOSE 8501
|
|
|
|
| 35 |
chromium-driver \
|
| 36 |
&& rm -rf /var/lib/apt/lists/*
|
| 37 |
|
| 38 |
+
# Create a non-root user and set up the /app directory
|
| 39 |
+
RUN useradd -m -u 1000 appuser && \
|
| 40 |
+
mkdir -p /app && \
|
| 41 |
+
chown -R appuser:appuser /app
|
| 42 |
+
|
| 43 |
# Install Python dependencies
|
| 44 |
COPY requirements.txt /tmp/requirements.txt
|
| 45 |
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 46 |
|
| 47 |
# Copy app code
|
| 48 |
COPY . /app
|
| 49 |
+
|
| 50 |
+
# Set working directory and permissions
|
| 51 |
WORKDIR /app
|
| 52 |
+
RUN chown -R appuser:appuser /app
|
| 53 |
+
|
| 54 |
+
# Switch to non-root user
|
| 55 |
+
USER appuser
|
| 56 |
|
| 57 |
# Expose Streamlit port
|
| 58 |
EXPOSE 8501
|