-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build(docker): Docker file created * build(script): Build script DONE * fix(gitignore): removign unecessary directories * fix(comments): Removing unecessary comments
- Loading branch information
Showing
11 changed files
with
140 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
node_modules | ||
package-lock.json | ||
hapi/ | ||
output/ | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FROM openjdk:8-jdk-alpine | ||
RUN apk add --no-cache curl tar bash procps git npm | ||
|
||
# Downloading and installing Gradle | ||
# 1- Define a constant with the version of gradle you want to install | ||
ARG GRADLE_VERSION=5.6.2 | ||
|
||
# 2- Define the URL where gradle can be downloaded from | ||
ARG GRADLE_BASE_URL=https://services.gradle.org/distributions | ||
|
||
# 3- Define the SHA key to validate the gradle download | ||
# obtained from here https://gradle.org/release-checksums/ | ||
ARG GRADLE_SHA=32fce6628848f799b0ad3205ae8db67d0d828c10ffe62b748a7c0d9f4a5d9ee0 | ||
|
||
|
||
# 4- Create the directories, download gradle, validate the download, install it, remove downloaded file and set links | ||
RUN mkdir -p /usr/share/gradle /usr/share/gradle/ref \ | ||
&& echo "Downlaoding gradle hash" \ | ||
&& curl -fsSL -o /tmp/gradle.zip ${GRADLE_BASE_URL}/gradle-${GRADLE_VERSION}-bin.zip \ | ||
\ | ||
&& echo "Checking download hash" \ | ||
&& echo "${GRADLE_SHA} /tmp/gradle.zip" | sha256sum -c - \ | ||
\ | ||
&& echo "Unziping gradle" \ | ||
&& unzip -d /usr/share/gradle /tmp/gradle.zip \ | ||
\ | ||
&& echo "Cleaning and setting links" \ | ||
&& rm -f /tmp/gradle.zip \ | ||
&& ln -s /usr/share/gradle/gradle-${GRADLE_VERSION} /usr/bin/gradle | ||
|
||
# 5- Define environmental variables required by gradle | ||
ENV GRADLE_VERSION 4.0.1 | ||
ENV GRADLE_HOME /usr/bin/gradle | ||
ENV GRADLE_USER_HOME /cache | ||
|
||
ENV PATH $PATH:$GRADLE_HOME/bin | ||
|
||
WORKDIR /hapi-visualizer/ | ||
|
||
COPY . /hapi-visualizer/ | ||
RUN bash build.sh --from-scratch | ||
EXPOSE 8080 | ||
ENTRYPOINT [ "bash", "build.sh"] | ||
CMD ["run"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
# hapi-visualizer | ||
|
||
with docker | ||
```bash | ||
docker build -t hapi-visualizer . | ||
docker run -p <local port>:8080 -d --rm hapi-visualizer | ||
``` | ||
|
||
without docker | ||
``` | ||
/bin/bash build.sh run --from-scratch | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#! /bin/bash | ||
|
||
dependencies=(git gradle java npm node) | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
check (){ | ||
for i in "${dependencies[@]}"; | ||
do | ||
if ! command -v "$i" &> /dev/null; then | ||
echo "$i could not be found" | ||
exit | ||
fi | ||
done | ||
} | ||
|
||
update_jar () { | ||
cd $DIR | ||
cd hapi | ||
git checkout -B visualizer origin/visualizer | ||
git pull origin visualizer | ||
|
||
gradle build-all-tools --no-daemon | ||
|
||
cd $DIR | ||
mv hapi/build/libs/* bin/ | ||
} | ||
|
||
from_scratch () { | ||
cd $DIR | ||
rm yes | rm -r hapi | ||
git clone https://github.com/lac-dcc/hapi.git | ||
cd hapi | ||
git checkout -b visualizer origin/visualizer | ||
update_jar | ||
} | ||
|
||
help_msg () { | ||
echo "Hapi visualizer builder." | ||
echo | ||
echo "Usage: bash build.sh <[COMMAND] | [FLAG]>" | ||
echo "COMMAND": | ||
echo "run Starts the nodejs server" | ||
echo | ||
echo "FLAG:" | ||
echo "--update Pull code from the lastest version of hapi repo and rebuild" | ||
echo " the .jar ." | ||
echo "--from-scratch First build of the hapi visualizer." | ||
echo | ||
exit | ||
} | ||
|
||
start_nodejs () { | ||
cd $DIR | ||
npm install | ||
npm start | ||
} | ||
|
||
flags () { | ||
case $1 in | ||
--update) update_jar ;; | ||
--from-scratch) from_scratch;; | ||
*) help_msg ;; | ||
esac | ||
} | ||
|
||
main () { | ||
check dependencies | ||
|
||
# frist argument is not null | ||
if [ "$1" = "run" ]; then | ||
if ! [ -z "$2" ]; then | ||
flags $2 | ||
fi | ||
start_nodejs | ||
elif ! [ -z "$1" ]; then | ||
flags $1 | ||
else | ||
help_msg | ||
fi | ||
} | ||
|
||
main $@ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.