-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (22 loc) · 1.1 KB
/
Copy pathDockerfile
File metadata and controls
33 lines (22 loc) · 1.1 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
FROM python:3.11-slim
LABEL maintainer="openenv-community"
LABEL org.opencontainers.image.description="License Compliance Scanner — OpenEnv AI Agent Environment"
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Verify imports compile cleanly (no DB connection needed at build time)
RUN python -c "from env.environment import LicenseComplianceEnv; print('✓ Import OK')"
# Run all unit tests (server tests now mock the DB pool — no live DB needed)
RUN python -m pytest tests/ -q && echo "✓ All unit tests pass"
# DATABASE_URL must be injected at runtime — fail fast if missing
# Example: postgresql://user:pass@host:5432/dbname?sslmode=require
ENV DATABASE_URL=""
ENV PORT=7860
EXPOSE 7860
RUN useradd -m -u 1000 agent && chown -R agent:agent /app
USER agent
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD curl -f http://localhost:${PORT}/health || exit 1
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]