-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (47 loc) · 1.82 KB
/
Dockerfile
File metadata and controls
58 lines (47 loc) · 1.82 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM python:3.12-slim
# Install system dependencies first (as root)
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install uv as root
RUN pip install --no-cache-dir uv
# Copy requirements and install dependencies AS ROOT
COPY requirements.txt .
RUN uv pip install --system --no-cache-dir -r requirements.txt
# Create a non-root user AFTER installing packages
RUN groupadd -r appuser && useradd -r -g appuser appuser
# Create app directory and set ownership
RUN mkdir -p /app && chown -R appuser:appuser /app
RUN mkdir -p /app/app && chown -R appuser:appuser /app/app
# Set working directory
WORKDIR /app
# Copy application code with proper ownership
COPY --chown=appuser:appuser streamlit_app .
COPY --chown=appuser:appuser app/ /app/app
COPY --chown=appuser:appuser research_scripts /app/research_scripts
COPY --chown=appuser:appuser project_config.py /app/project_config.py
# Switch to non-root user for running the app
USER appuser
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
ENV STREAMLIT_GATHER_USAGE_STATS=false
# Run the application
CMD ["streamlit", "run", "streamlit_app/root_page.py", \
"--server.address=0.0.0.0", \
"--server.port=8501", \
"--server.headless=true", \
"--server.enableCORS=false", \
"--server.enableXsrfProtection=false", \
"--theme.base=light", \
"--theme.primaryColor=#FF6B6B", \
"--theme.backgroundColor=#FFFFFF", \
"--theme.secondaryBackgroundColor=#F0F2F6", \
"--theme.textColor=#262730"]
# Add metadata labels
LABEL maintainer="mikhail.solovyanov@gmail.com" \
version="1.0.0" \
description="Streamlit webapp for drug search app" \
org.opencontainers.image.licenses="MIT" \
Name="hotels-price-absorber-streamlit"