FROM ubuntu:22.04

RUN apt-get update -y && apt-get upgrade -y && apt-get clean -y

# Install packages for building HIRS ACA
RUN apt-get -y install openjdk-17-jdk  mariadb-server
RUN apt-get -y install git curl nano cron

# Ports needed for system-level tests
EXPOSE 8080
EXPOSE 8443

# Checkout HIRS main branch and run gradlew to install gradlew dependencies, then delete HIRS
# Use '--depth=1' so as to not download the history of all commits
RUN git clone -b main --depth=1 https://github.com/nsacyber/HIRS.git /hirsTemp
WORKDIR "/hirsTemp"
RUN /bin/bash -c './gradlew clean build'
WORKDIR "/"
RUN rm -rf /hirsTemp
