-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (28 loc) · 1020 Bytes
/
Dockerfile
File metadata and controls
37 lines (28 loc) · 1020 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
37
FROM python:3.12-slim
# Install system deps for ansible and ssh
RUN apt-get update && apt-get install -y --no-install-recommends \
openssh-client \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install Ansible collections
COPY requirements.yml .
RUN ansible-galaxy collection install -r requirements.yml -p /usr/share/ansible/collections
# Copy application
COPY app/ app/
COPY playbooks/ playbooks/
COPY inventory/ inventory/
# Set env defaults
ENV PROJECT_ROOT_DIR=/app
ENV API_BACKEND_WWWAPP_PLAYBOOKS_DIR=/app/
ENV API_BACKEND_INVENTORY_DIR=/app/inventory/
ENV HOST=0.0.0.0
ENV PORT=8000
ENV PYTHONPATH=/app
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import httpx; httpx.get('http://localhost:8000/docs/openapi.json').raise_for_status()"
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--log-level", "info"]