Skip to content

Commit

Permalink
Update docker file to install Maven and Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
donggyu04 committed Nov 26, 2020
1 parent 73c935a commit 4161f3c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
30 changes: 28 additions & 2 deletions docker/controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
FROM jeanblanchard/java:serverjre-8
MAINTAINER JunHo Yoon "[email protected]"

RUN apk update; apk add curl bash
RUN apk update; apk add curl bash tar

ARG MAVEN_VERSION=3.6.3
ARG MAVEN_DOWNLOAD_BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries

ARG GRADLE_VERSION=6.7.1
ARG GRADLE_DOWNLOAD_BASE_URL=https://services.gradle.org/distributions

# Install maven
RUN mkdir -p /usr/share/maven \
&& echo "Downloading maven" \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${MAVEN_DOWNLOAD_BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
&& echo "Unziping maven" \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
&& rm -f /tmp/apache-maven.tar.gz

# Install gradle
RUN mkdir -p /usr/share/gradle \
&& echo "Downloading gradle" \
&& curl -fsSL -o /tmp/gradle.zip ${GRADLE_DOWNLOAD_BASE_URL}/gradle-${GRADLE_VERSION}-bin.zip \
&& echo "Unziping gradle" \
&& unzip -d /usr/share/gradle /tmp/gradle.zip \
&& rm -f /tmp/gradle.zip

# Set up environment variables
ENV BASE_DIR=/opt \
NGRINDER_HOME=/opt/ngrinder-controller
NGRINDER_HOME=/opt/ngrinder-controller \
MAVEN_HOME=/usr/share/maven \
GRADLE_HOME=/usr/share/gradle/gradle-${GRADLE_VERSION}

ENV PATH=$PATH:$GRADLE_HOME/bin:$MAVEN_HOME/bin

# Expose ports
EXPOSE 80 16001 12000-12009
Expand Down
6 changes: 5 additions & 1 deletion docker/controller/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env bash
echo "wait a while extracting war files... It takes time for the first run."
echo "Installed build tools."
mvn -version
gradle -version

echo "Wait a while extracting war files... It takes time for the first run."
java -jar ${BASE_DIR}/ngrinder-*.war --port 80
2 changes: 1 addition & 1 deletion docker/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
echo "copying ngrinder-controller"
mkdir -p controller/binary
rm controller/binary/ngrinder*
cp ../ngrinder-controller/target/*.war controller/binary/
cp ../ngrinder-controller/build/libs/*.war controller/binary/

0 comments on commit 4161f3c

Please sign in to comment.