Skip to content

Instantly share code, notes, and snippets.

@ddanila
Created May 27, 2022 07:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddanila/5967b04e2b1979df0163d6ffcfec3487 to your computer and use it in GitHub Desktop.
Save ddanila/5967b04e2b1979df0163d6ffcfec3487 to your computer and use it in GitHub Desktop.
LCA Collaboration Server 1.3.0 Dockerfile
# LICENSE: MIT
FROM ubuntu:20.04
WORKDIR /
# Taken from here: https://www.openlca.org/lca-collaboration-server-1-3-0-installation-guide/
# some networking was removed as it's not applicable
# NB: download and put to the local artefact folder the following files:
# https://www.openlca.org/wp-content/uploads/2022/04/lca-collaboration-1.3.0_2022-04-13.war
# https://www.openlca.org/wp-content/uploads/2022/02/lca-collaboration-installer-1.3.0_2022-02-08.jar
# and https://www.openlca.org/wp-content/uploads/2022/05/lca-collaboration-server-files-1.3.0_2022-02-08.zip
# (note the link to .zip is broken in the manual, it's /2022/04 instead of /2022/05)
# Unzip contents of zip-file to the arteract folder
# Node.js is not included, note the bugs in the manual
# cp /root/lca-cs/package.json /root/lca-cs/server.js /opt/cs/ssr
# then forever start /opt/collab/ssr/server.js
# -- /opt/cs/ssr vs /opt/collab/ssr, wrong folder in forever start
# 1. Update the OS and install dependencies
RUN apt-get update
RUN apt-get dist-upgrade -y
RUN apt-get install apt-utils gnupg2 wget openjdk-8-jdk -y
RUN apt-get install mc -y
# 2. Install elasticsearch
RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
RUN echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-6.x.list
RUN apt-get update
RUN apt-get install elasticsearch -y
RUN sed -i 's/Xms1g/Xms4g/g' /etc/elasticsearch/jvm.options
RUN sed -i 's/Xmx1g/Xmx4g/g' /etc/elasticsearch/jvm.options
# Preparing artefacts
RUN mkdir -p /root/lca-cs
COPY artefact/lca-collaboration-1.3.0_2022-04-13.war /root/lca-cs
COPY artefact/lca-collaboration-installer-1.3.0_2022-02-08.jar /root/lca-cs
COPY artefact/tomcat9.service /root/lca-cs
COPY artefact/server.xml /root/lca-cs
COPY artefact/lca-collaboration-installer-1.3.0_2022-02-08.conf /root/lca-cs
# 3. Install Tomcat
RUN groupadd tomcat9
RUN useradd -s /bin/false -g tomcat9 -d /var/lib/tomcat9 tomcat9
RUN mkdir /var/lib/tomcat9
RUN wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.52/bin/apache-tomcat-9.0.52.tar.gz
RUN tar xzvf apache-tomcat-9.0.52.tar.gz -C /var/lib/tomcat9 --strip-components=1
RUN rm apache-tomcat-9.0.52.tar.gz
RUN chgrp -R tomcat9 /var/lib/tomcat9
RUN chmod -R g+r /var/lib/tomcat9/conf
RUN chmod g+x /var/lib/tomcat9/conf
RUN chown -R tomcat9 /var/lib/tomcat9/webapps/ /var/lib/tomcat9/work/ /var/lib/tomcat9/temp/ /var/lib/tomcat9/logs/
RUN mv /root/lca-cs/tomcat9.service /etc/systemd/system/tomcat9.service
RUN mv /root/lca-cs/server.xml /var/lib/tomcat9/conf/server.xml
# 4. Install certbot and create an ssl certificate
# 5. Install apache2
# Skipped -- this will be handled on the ALB layer
# 6. Run the installer
RUN java -jar /root/lca-cs/lca-collaboration-installer-1.3.0_2022-02-08.jar /root/lca-cs/lca-collaboration-installer-1.3.0_2022-02-08.conf
RUN chown tomcat9:tomcat9 /opt -R
# we will need to run this later on working image to create the index (if it's not created yet)
RUN mkdir -p /opt/cs/misc
RUN cp /root/lca-cs/lca-collaboration-installer-1.3.0_2022-02-08.jar /opt/cs/misc/lca-collaboration-installer.jar
RUN cp /root/lca-cs/lca-collaboration-installer-1.3.0_2022-02-08.conf /opt/cs/misc/lca-collaboration-installer.conf
# 7. Copy webapp
RUN rm /var/lib/tomcat9/webapps/* -r
RUN cp /root/lca-cs/lca-collaboration-1.3.0_2022-04-13.war /var/lib/tomcat9/webapps/ROOT.war
RUN rm /root/lca-cs -r
# Entrypoint
CMD ["/bin/sh", "/var/lib/tomcat9/bin/catalina.sh", "run"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment