Commit 3e486bdb by Benedikt Ritter

Add assemble and usage scripts

parent c3164998
#!/bin/bash -e
#
# Default STI assemble script for the 'springboot-maven3-centos' image.
#
if [ "$1" = "-h" ]; then
exec /opt/java/bin/usage
fi
APP_RUNTIME_DIR="${HOME}/src"
APP_SRC_DIR="/tmp/src"
echo "---> Installing application source"
mkdir -p ${APP_RUNTIME_DIR}
cp -Rf ${APP_SRC_DIR}/* ${APP_RUNTIME_DIR}/
pushd "$APP_RUNTIME_DIR/${APP_ROOT}" >/dev/null
echo "---> Building Spring Boot application from source"
mvn clean install
popd >/dev/null
#!/bin/sh
cat <<EOF
This is a STI springboot maven3 centos base image:
To use it, install STI: https://github.com/openshift/source-to-image
Sample invocation:
sti build git://github.com/codecentric/spring-boot-sample codecentric/springboot-maven3-centos springboot-app
You can then run the resulting image via:
docker run -p 8080:8080 sinatra-app
EOF
...@@ -13,10 +13,42 @@ RUN yum update -y && \ ...@@ -13,10 +13,42 @@ RUN yum update -y && \
yum install -y java-$JAVA_VERSON-openjdk java-$JAVA_VERSON-openjdk-devel && \ yum install -y java-$JAVA_VERSON-openjdk java-$JAVA_VERSON-openjdk-devel && \
yum clean all yum clean all
ENV JAVA_HOME /usr/lib/jvm/java
RUN curl -fsSL https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar xzf - -C /usr/share \ RUN curl -fsSL https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar xzf - -C /usr/share \
&& mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven \ && mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV JAVA_HOME /usr/lib/jvm/java
ENV MAVEN_HOME /usr/share/maven ENV MAVEN_HOME /usr/share/maven
# Add configuration files, bashrc and other tweaks
ADD ./.sti/bin/usage /opt/java/bin/
# Default STI scripts url
ENV STI_SCRIPTS_URL https://raw.githubusercontent.com/codecentric/springboot-maven3-centos/master/.sti/bin
# Default destination of scripts and sources, this is where assemble will look for them
ENV STI_LOCATION /tmp
# Create 'ruby' account we will use to run Ruby application
# Add support for '#!/usr/bin/ruby' shebang.
RUN mkdir -p /opt/java/src && \
groupadd -r java -f -g 433 && \
useradd -u 431 -r -g java -d /opt/java -s /sbin/nologin -c "Java user" java && \
chown -R java:java /opt/java
# Set the 'root' directory for this build
#
# This can be overridden inside another Dockerfile that uses this image as a base
# image or in STI via the '-e "APP_ROOT=subdir"' option.
#
# Use this in case when your application is contained in a subfolder of your
# GIT repository. The default value is the root folder.
ENV APP_ROOT .
ENV HOME /opt/java
ENV PATH $HOME/bin:$PATH
WORKDIR /opt/java/src
USER java
EXPOSE 8080
CMD ["/opt/java/bin/usage"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment