-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
56 lines (45 loc) · 1.74 KB
/
Copy pathDockerfile.dev
File metadata and controls
56 lines (45 loc) · 1.74 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
50
51
52
53
54
55
56
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
git xz-utils openssh-client curl wget vim kubectl \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Install kind
ARG KIND_VERSION=v0.20.0
RUN curl -Lo /usr/local/bin/kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64 \
&& chmod +x /usr/local/bin/kind
# Create user
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd -g ${USER_GID} operator_group \
&& useradd -u ${USER_UID} -g operator_group -m -s /bin/bash operator_user \
&& mkdir -p /home/operator_user/.kube /app/.kube \
&& chown -R operator_user:operator_group /home/operator_user /app
ADD https://install.determinate.systems/nix /tmp/nix-installer
# Install Nix (will be cached if installer doesn't change)
RUN chmod +x /tmp/nix-installer \
&& /tmp/nix-installer install linux \
--extra-conf "sandbox = false" \
--extra-conf "filter-syscalls = false" \
--init none \
--no-confirm \
&& rm -f /tmp/nix-installer
ENV PATH="${PATH}:/nix/var/nix/profiles/default/bin"
WORKDIR /app
# Copy and install dependencies (including dev dependencies for debugging)
COPY requirements.txt requirements-dev.txt ./
RUN pip install --no-cache-dir -r requirements-dev.txt
# In development mode, source code is mounted as volume
# So we don't COPY it here
# Copy only essential runtime files for NICO
COPY main.py .
COPY kubernetescluster_handlers.py .
COPY clients.py .
COPY utils.py .
COPY events.py .
COPY metrics.py .
COPY scripts/ ./scripts/
COPY crds/ ./crds/
ENV KUBECONFIG=/app/.kube/config PYTHONUNBUFFERED=1 PYTHONPATH=/app
# Default command with debugger
CMD ["python", "-m", "debugpy", "--listen", "0.0.0.0:5678", "--wait-for-client", "main.py"]