ARG BASE_IMAGE=''
FROM $BASE_IMAGE
ARG BASE_IMAGE=''
ARG GENERATE_COVERAGE_REPORT
RUN echo $GENERATE_COVERAGE_REPORT
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/metrics_query_server/python/lib/:/metrics_query_server/python/lib/avi/protobuf/

WORKDIR /metrics_query_server
COPY metrics_query_server /metrics_query_server

COPY protobuf/py_gen/vmware/nsx/timeseries/*.py /metrics_query_server/python/lib/avi/protobuf/vmware/nsx/timeseries/

EXPOSE 5098
RUN if [ "$GENERATE_COVERAGE_REPORT" = "true" ]; then pip install coverage; fi
RUN export PATH="$PATH:/home/metrics/.local/bin"
RUN groupadd --gid 5000 metrics \
    && useradd --home-dir /home/metrics --create-home --uid 5000 \
        --gid 5000 --shell /bin/sh --skel /dev/null metrics
USER metrics
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["python3", "python/metricsapi_server/metricsapi_server.py"]
