FROM open-liberty:21.0.0.9-full-java8-openj9

#Copy HATS project ear to dropins folder of Liberty server
COPY HATSProjEAR.ear /config/dropins/

#Create a folder with name runtime and copy runtime.properties file inside that folder
RUN mkdir -p /runtime 
ADD runtime.properties /runtime

#Create a folder with name connection and copy main.hco file inside that folder
RUN mkdir -p /connection
ADD main.hco /connection

#Below lines are used to create folder in environemnt variable path to keep runtime.properties outside the HATS EAR
RUN mkdir -p /home/runtime/HatsProj
RUN chmod -R 777 /home/runtime/HatsProj

#Below lines are used to create folder in environemnt variable path to configure main.hco file outside the HATS Project
RUN mkdir -p /home/connection/HatsProj/connections
RUN chmod -R 777 /home/connection/HatsProj/connections

COPY --chown=1001:0 wrapper.sh /
RUN chmod +x /wrapper.sh
COPY --chown=1001:0 copyruntime.sh /
RUN chmod +x /copyruntime.sh

USER 1001
CMD ["sh", "/wrapper.sh"]

