Spring Boot and RESTful API(11)Deployment and Docker
Find Market Place and search for buildship, Install plugin for Gradle
The import the project into Eclipse from Import Gradle Project
Clean the svn or git information
>find . -name ".svn" | xargs rm -Rf
>find . -name ".git" | xargs rm -Rf
On CentOS
here is the start file start.sh
#!/bin/sh -ex
APPLICATION_SECRET="nosessionshere"
cd /share/
java \
-Xms2G -Xmx2G -XX:MaxMetaspaceSize=256M \
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="/tmp/dump_oom.hprof" \
-jar -Dspring.profiles.active=prod price-monitor-server.jar 2>&1
Here is the Makefile to build the image
IMAGE=sillycat/public
TAG=centos7-price-monitor-server
NAME=centos7-price-monitor-server
app-build:
./gradlew clean build -x test
docker-context:
build: docker-context
docker build -t $(IMAGE):$(TAG) .
run:
docker run -d -p 8080:8080 --name $(NAME) $(IMAGE):$(TAG)
debug:
docker run -ti -p 8080:8080 --name $(NAME) $(IMAGE):$(TAG) /bin/bash
clean:
docker stop $(NAME)
docker rm $(NAME)
logs:
docker logs ${NAME}
publish:
docker push ${IMAGE}
Here is the steps and features in Dockerfile
#Run a Simple REST API based on playframework
#Prepre the OS
FROM centos:7
MAINTAINER Carl Luo <[email protected]>
ENV DEBIAN_FRONTEND noninteractive
#Prepare S3 command tool
RUNyum --enablerepo=extras -y install epel-release
RUNyum -y update
RUNyum -y install python-pip
RUNpip install --upgrade pip
ENV PATH="~/.local/bin:${PATH}"
#Install Java
RUN yum install -y java-1.8.0-openjdk
#Install the Application
RUN mkdir /share/
WORKDIR /share/
ADD build/libs/price-monitor-server.jar /share/
#Start the Application
EXPOSE 8080
RUN mkdir -p /app/
ADD start.sh /app/
WORKDIR /app
CMD[ "./start.sh" ]
On RaspberryPi
References:
http://www.vogella.com/tutorials/EclipseGradle/article.html#eclipse-gradle-support
Spring Boot and RESTful API(11)Deployment and Docker
猜你喜欢
转载自sillycat.iteye.com/blog/2395278
今日推荐
周排行