@@ -2,36 +2,42 @@ FROM pytorch/pytorch:2.7.0-cuda11.8-cudnn9-runtime
22
33LABEL maintainer="Pascal Debus" \
44 description="QML Playground" \
5- version="1.0"
5+ version="1.0" \
6+ org.opencontainers.image.source="https://github.com/fraunhofer-aisec/qml-playground"
67
78# Set working directory inside the container
89WORKDIR /app
910
10- # Install curl and dependencies
11+ # Install curl and dependencies in one layer
1112RUN apt-get update && \
12- apt-get install -y curl && \
13+ apt-get install -y --no-install-recommends curl && \
14+ apt-get clean && \
1315 rm -rf /var/lib/apt/lists/*
1416
15- # Copy requirements and install (skip torch)
17+ # Copy requirements first for better layer caching
1618COPY requirements.txt /app/requirements.txt
17- RUN pip install --no-cache-dir $(grep -v "torch" /app/requirements.txt)
1819
19- # Copy the app code from ./app in host into /app in container
20+ # Install Python dependencies (skip torch as it's in base image)
21+ RUN pip install --no-cache-dir --upgrade pip && \
22+ pip install --no-cache-dir $(grep -v "torch" /app/requirements.txt)
23+
24+ # Copy the app code
2025COPY app/ /app/
2126
2227# Create and use non-root user
2328RUN groupadd -r appuser && \
24- useradd -r -g appuser appuser && \
29+ useradd -r -g appuser -d /app -s /sbin/nologin appuser && \
2530 chown -R appuser:appuser /app
31+
2632USER appuser
2733
28- # Healthcheck
29- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
30- CMD curl --fail http://localhost:8050/ || exit 1
34+ # Healthcheck - Updated to use the correct path
35+ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
36+ CMD curl --fail http://localhost:8050/qml-playground/ || exit 1
3137
3238ENV PYTHONPATH="${PYTHONPATH}:/app"
3339
3440EXPOSE 8050
3541
3642# Start the Dash app using gunicorn
37- CMD ["gunicorn" , "app:server" , "--bind" , "0.0.0.0:8050" ]
43+ CMD ["gunicorn" , "app:server" , "--bind" , "0.0.0.0:8050" , "--workers" , "1" , "--timeout" , "120" ]
0 commit comments