-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.test
More file actions
36 lines (27 loc) · 967 Bytes
/
Copy pathDockerfile.test
File metadata and controls
36 lines (27 loc) · 967 Bytes
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
# Test-specific Dockerfile with test dependencies
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install system dependencies including curl for health checks
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY backend/requirements.txt .
COPY tests/requirements-test.txt ./requirements-test.txt
# Install both production and test dependencies
RUN pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir -r requirements-test.txt
# Copy application code
COPY backend/ .
# Create non-root user for security
RUN groupadd -r appuser && useradd -r -g appuser appuser
RUN chown -R appuser:appuser /app
USER appuser
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/api/health || exit 1
# Run application
CMD ["python", "main.py"]