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/integration_tester

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

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

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