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_functional

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

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

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