dockerfile-java

1:dockerfile

  FROM centos:7
  MAINTAINER wang
  RUN mkdir /usr/local/java
  ADD jdk-8u131-linux-x64.tar.gz /usr/local/java
  ENV JAVA_HOME /usr/local/java/jdk1.8.0_131
  ENV JRE_HOME ${JAVA_HOME}/jre
  ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib
  ENV PATH ${JAVA_HOME}/bin:$PATH
  ADD jar.sh /opt/
  RUN chmod +x /opt/jar.sh
  RUN /opt/jar.sh

2: jar.sh

  #!/bin/bash
  expect -c "
  spawn nohup java -jar shopping-provider-0.0.1-SNAPSHOT.jar &
  expect \"nohup: ignoring input and appending output to ‘nohup.out’\"
  send \"\r\"
  expect eof
  "
  sleep 5

  expect -c "
  spawn nohup java -jar user-provider-0.0.1-SNAPSHOT.jar &
  expect \"nohup: ignoring input and appending output to ‘nohup.out’\"
  send \"\r\"
  expect eof
  "
  sleep 5

  expect -c "
  spawn nohup java -jar gpmall-shopping-0.0.1-SNAPSHOT.jar &
  expect \"nohup: ignoring input and appending output to ‘nohup.out’\"
  send \"\r\"
  expect eof
  "
  sleep 5

  expect -c "
  spawn nohup java -jar gpmall-user-0.0.1-SNAPSHOT.jar &
  expect \"nohup: ignoring input and appending output to ‘nohup.out’\"
  send \"\r\"
  expect eof
  "
posted @ 2020-10-24 15:58  BlueSky-  阅读(208)  评论(0)    收藏  举报