FROM python:3-slim

# Install dependencies
RUN apt-get --yes --quiet --quiet update && \
    apt-get --yes --quiet --quiet install wget g++ && \
    rm -rf /var/lib/apt/lists/*

# Set Python to show logs as they occur
ENV PYTHONUNBUFFERED=0

# Get generic Python packages
RUN python3 -m pip install --upgrade pip setuptools wheel pip-tools

# Set working directory
WORKDIR /var/teraflow

# Create module sub-folders
RUN mkdir -p /var/teraflow/tester_integration

# Get Python packages per module
COPY tester_integration/requirements.in tester_integration/requirements.in
RUN pip-compile --output-file=tester_integration/requirements.txt tester_integration/requirements.in
RUN python3 -m pip install -r tester_integration/requirements.in

# Add files into working directory
COPY common/. common
COPY context/. context
COPY device/. device
COPY service/. service
COPY tester_integration/. tester_integration

# Run integration tester
ENTRYPOINT ["pytest", "-v", "--log-level=DEBUG", \
            "tester_integration/test_context_device_service.py" \
]
