-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (35 loc) · 1.05 KB
/
Dockerfile
File metadata and controls
49 lines (35 loc) · 1.05 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
# Multi-stage build for DocumentDB Functional Tests
# Stage 1: Build stage
FROM python:3.11-slim AS builder
WORKDIR /build
# Copy requirements
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir --user -r requirements.txt
# Stage 2: Runtime stage
FROM python:3.11-slim
# Create non-root user
RUN useradd -m -u 1000 testrunner
# Set working directory
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /root/.local /home/testrunner/.local
# Copy application code
COPY tests/ tests/
COPY result_analyzer/ result_analyzer/
COPY conftest.py .
COPY pytest.ini .
COPY setup.py .
# Create directory for test results and set ownership
RUN mkdir -p .test-results && \
chown -R testrunner:testrunner /app
# Switch to non-root user
USER testrunner
# Ensure scripts are in PATH
ENV PATH=/home/testrunner/.local/bin:$PATH
# Set Python to run unbuffered (so logs appear immediately)
ENV PYTHONUNBUFFERED=1
# Default command: run all tests
# Users can override with command line arguments
ENTRYPOINT ["pytest"]
CMD ["--help"]