Skip to content

Commit

Permalink
work in progress branch for dockerizing SBOLCanvas.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Bridge authored and Sam Bridge committed Feb 27, 2020
1 parent 88ec504 commit 11ad171
Show file tree
Hide file tree
Showing 26 changed files with 54 additions and 1 deletion.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM alpine

RUN apk add openjdk8 bash

ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
ENV PATH="$JAVA_HOME/bin:${PATH}"

WORKDIR /opt/backend

COPY . .

# This should be in the Dockerfile, but for now it's a script
RUN resources/build_automation/build_backend.sh

## Build angular stuff and copy into WEB-INF
RUN apk add --update nodejs npm
RUN npm install -g @angular/cli
RUN resources/build_automation/build_frontend.sh

# New container
FROM tomcat:9.0-jdk8-openjdk
COPY --from=0 SBOLCanvasBackend/WebContent/api.war webapps

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added SBOLCanvasBackend/WebContent/api.war
Binary file not shown.
Binary file added resources/api.war
Binary file not shown.
19 changes: 19 additions & 0 deletions resources/build_automation/build_backend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

BACKEND_DIR=$(pwd)/SBOLCanvasBackend
compile_dest_dir=${BACKEND_DIR}/WebContent/WEB-INF/classes
compile_source_dir=${BACKEND_DIR}/src
tomcat_dependencies=$(pwd)/resources/server_automation/tomcat/apache-tomcat-9.0.26/lib
other_dependencies=${BACKEND_DIR}/WebContent/WEB-INF/lib
war_filename=api.war
cur_dir=$(pwd)

# Compile java files into the SBOLCanvasBackend/WebContent/WEB-INF/classes directory
[[ -d ${compile_dest_dir} ]] && rm -rf ${compile_dest_dir} # Make sure we have a clean slate
mkdir ${compile_dest_dir}

javac -source 1.8 -target 1.8 -sourcepath ${compile_source_dir} -d ${compile_dest_dir} -cp ".:${other_dependencies}/*:${tomcat_dependencies}/*" ${compile_source_dir}/**/*.java\

# Build .war file and deploy
cd ${BACKEND_DIR}/WebContent
jar -cf ${war_filename} *
11 changes: 11 additions & 0 deletions resources/build_automation/build_frontend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

echo "----------- Deploying frontend... ------------"

# Build front end
cur_dir=$(pwd) # Save away our current directory to come back to.
cd SBOLCanvasFrontend
npm install
#ng build --prod --base-href=/canvas/
ng build --prod --build-optimizer --vendor-chunk --progress --output-hashing=all --stats-json --source-map=true --base-href=/canvas/

Binary file added resources/server_automation/.Dockerfile.swp
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/server_automation/deploy_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ ensure_superuser
./deploy_backend.sh || die "Backend deployment failed"
./deploy_frontend.sh || die "Frontend deployment failed"

echo "SBOL Canvas successfully deployed!"
echo "SBOL Canvas successfully deployed!"

0 comments on commit 11ad171

Please sign in to comment.