# Single stage build for Cluster Node
FROM python:3.12-slim
WORKDIR /app

# Install necessary runtime packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    wireguard \
    iptables \
    iproute2 \
    net-tools \
    inetutils-ping \
    inetutils-traceroute \
    procps \
    curl \
    nano \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python packages
# Using the specific requirements.txt for this container
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy the application code
COPY . /app/

# Set execution permissions on scripts
RUN chmod +x /app/entrypoint.sh

ARG SERVER_ADDRESS
ARG DEBUG_MODE

ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["python", "-u", "/app/cluster_worker.py"]
