FROM rockylinux:8.6

SHELL ["/bin/bash", "-c"]

# Update and install OS-dependencies
RUN dnf update -y

# Install Java 
RUN dnf -y install java-17-openjdk-devel -y

# Install Tomcat
#RUN useradd -r -d /opt/tomcat/ -s /bin/false -c "Tomcat User" tomcat 
#RUN dnf install wget -y
#RUN wget https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.1/bin/apache-tomcat-10.1.1.tar.gz
#RUN mkdir /opt/tomcat 
#RUN tar -xzf apache-tomcat-10.1.1.tar.gz -C /opt/tomcat --strip-components=1

# Install HIRS dependencies
RUN dnf install -y mariadb-server rpmdevtools initscripts firewalld policycoreutils net-tools libtool cmake make git gcc-c++ cronie  && yum clean all
RUN dnf install -y wget openssl openssl-devel protobuf tpm2-tss-devel tpm2-abrmd  libcurl-devel libssh-devel && yum clean all

# Install PACCOR for Device Info Gathering
RUN mkdir paccor && pushd paccor && wget https://github.com/nsacyber/paccor/releases/download/v1.1.4r2/paccor-1.1.4-2.noarch.rpm && yum -y install paccor-*.rpm && popd

# Install TPM Emulator for Provisioning
RUN mkdir ibmtpm && pushd ibmtpm && wget --no-check-certificate https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm1332.tar.gz && tar -zxvf ibmtpm1332.tar.gz && cd src && make -j5 && popd

# Install Microsoft dotnet and rpm  package tool
RUN wget https://dot.net/v1/dotnet-install.sh
RUN sh dotnet-install.sh --os linux --channel LTS
ENV PATH="/root/.dotnet:${PATH}"
RUN wget https://packages.microsoft.com/rhel/8/prod/packages-microsoft-prod.rpm
RUN dnf -y install packages-microsoft-prod.rpm
RUN dnf makecache
RUN dnf -y install dotnet-sdk-6.0
RUN dotnet tool install --global dotnet-rpm

EXPOSE 8443
