content: # ref: https://hub.docker.com/_/fedora
  FROM fedora:42 AS env
  
  #############
  ##  SETUP  ##
  #############
  RUN dnf -y update \
  && dnf -y install git \
   wget which lsb_release pkgconfig autoconf libtool zlib-devel \
  && dnf -y install @development-tools \
  && dnf -y install gcc-c++ cmake \
  && dnf clean all
  ENTRYPOINT ["/usr/bin/bash", "-c"]
  CMD ["/usr/bin/bash"]
  
  # Install SWIG
  RUN dnf -y update \
  && dnf -y install swig \
  && dnf clean all
  
  # Install .Net
  # see: https://docs.microsoft.com/en-us/dotnet/core/install/linux-fedora
  RUN dnf -y update \
  && dnf -y install dotnet-sdk-8.0 crypto-policies-scripts \
  && dnf clean all
  # https://docs.redhat.com/en/documentation/net/6.0/html/release_notes_for_.net_6.0_rpm_packages/known-issues_release-notes-for-dotnet-rpms
  RUN update-crypto-policies --set DEFAULT:SHA1
  # Trigger first run experience by running arbitrary cmd
  RUN dotnet --info
  
  # Install Java
  RUN dnf -y update \
  && dnf -y install java-21-openjdk java-21-openjdk-devel maven \
  && dnf clean all
  ENV JAVA_HOME=/usr/lib/jvm/java-openjdk
  
  # Install Python
  RUN dnf -y update \
  && dnf -y install python3 python3-devel python3-pip \
  && dnf clean all
  RUN python3 -m pip install absl-py mypy mypy-protobuf
  
  ################
  ##  OR-TOOLS  ##
  ################
  FROM env AS devel
  WORKDIR /root
  # Copy the snk key
  COPY or-tools.snk /root/or-tools.snk
  ENV DOTNET_SNK=/root/or-tools.snk
  
  ARG SRC_GIT_BRANCH
  ENV SRC_GIT_BRANCH ${SRC_GIT_BRANCH:-main}
  ARG SRC_GIT_SHA1
  ENV SRC_GIT_SHA1 ${SRC_GIT_SHA1:-unknown}
  
  ARG OR_TOOLS_PATCH
  ENV OR_TOOLS_PATCH ${OR_TOOLS_PATCH:-9999}
  
  # Download sources
  # use SRC_GIT_SHA1 to modify the command
  # i.e. avoid docker reusing the cache when new commit is pushed
  RUN git clone -b "${SRC_GIT_BRANCH}" --single-branch --depth=1 https://github.com/google/or-tools \
  && [[ $(cd or-tools && git rev-parse --verify HEAD) == ${SRC_GIT_SHA1} ]]
  WORKDIR /root/or-tools
  
  # C++
  ## build
  FROM devel AS cpp_build
  RUN make detect_cpp \
  && make cpp JOBS=8
  ## archive
  FROM cpp_build AS cpp_archive
  RUN make archive_cpp
  
  # .Net
  ## build
  FROM cpp_build AS dotnet_build
  RUN make detect_dotnet \
  && make dotnet JOBS=8
  ## archive
  FROM dotnet_build AS dotnet_archive
  RUN make archive_dotnet
  
  # Java
  ## build
  FROM cpp_build AS java_build
  RUN make detect_java \
  && make java JOBS=8
  ## archive
  FROM java_build AS java_archive
  RUN make archive_java
  
  # Python
  ## build
  FROM cpp_build AS python_build
  RUN make detect_python \
  && make python JOBS=8
  ## archive
  FROM python_build AS python_archive
  RUN make archive_python
  