content: #
  # Copyright 2020-2022 Fraunhofer Institute for Software and Systems Engineering
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #    http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  FROM debian:11-slim AS build
  RUN apt-get update && \
      apt-get install --no-install-suggests --no-install-recommends --yes build-essential python3-venv gcc python3-dev && \
      python3 -m venv /venv && \
      /venv/bin/pip install --upgrade pip setuptools wheel && \
      apt-get clean && \
      rm -rf /var/lib/apt/lists/*
  COPY requirements.txt /requirements.txt
  RUN /venv/bin/pip install --disable-pip-version-check -r /requirements.txt
  
  FROM gcr.io/distroless/python3-debian11:debug-nonroot-amd64
  COPY --from=build /venv /venv
  COPY ./backend_server.py /app/backend_server.py
  WORKDIR /app
  
  ENV FLASK_APP=backend_server
  ENV FLASK_ENV=development
  
  EXPOSE 5000
  
  USER nonroot
  ENTRYPOINT [ "/venv/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
  