FROM theiaide/theia-java:1.4.0

USER root

RUN apt update
RUN apt upgrade -y
RUN apt install rsync -y

COPY plugins /home/plugins
COPY theia/plugin-storage/global-state.json /home/theia/.theia/plugin-storage/global-state.json
RUN chown theia /home/theia/.theia -R
RUN chown theia /home/plugins -R

COPY server.js /home/theia/src-gen/backend/server.js

COPY start.sh .

COPY recorder-out/dist/main.js deadlock/recorder.js
COPY recorder-out/dist/preStop.js deadlock/preStop.js
COPY .gitignore_recorder deadlock/.gitignore

RUN chmod 500 deadlock/ -R
RUN chmod 500 start.sh

ENTRYPOINT ["bash", "start.sh"]