Last active
May 11, 2019 03:25
-
-
Save yangl/bd1ea755da7bd4381cbe5c0a22687e36 to your computer and use it in GitHub Desktop.
spring-boot-saturn Dockerfile 例子 在外边调用dubbo内部的start.sh并tail -f /dev/null阻止容器退出
This file contains hidden or 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
docker build -t saturn-console:latest ./ | |
docker run --rm --name=saturn-console -itd -p28080:8080 -e DB_USER=root -e DB_PASSWORD=67890 saturn-console:latest | |
docker exec -it saturn-console /bin/sh | |
docker save xxxx > myap.tar | |
tar -zcvf myap.tar.gz myap.tar | |
tar -xzvf myap.tar.gz | |
docker load < myap.tar | |
docker export -o postgres-export.tar postgres | |
docker import postgres-export.tar postgres:latest |
This file contains hidden or 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
FROM openjdk:8-jdk-alpine | |
WORKDIR /app | |
COPY ./target/saturn-console*.jar ./saturn-console.jar | |
ENV TZ="Asia/Shanghai" \ | |
DB_URL="jdbc:mysql://ujp-m.dbsit.xxx.com.cn:3306/ujp" \ | |
DB_USERNAME="xxxx" \ | |
DB_PASSWORD="xxxx" | |
EXPOSE 8080 | |
ENTRYPOINT ["java", "-Dserver.port=8080", "-DSATURN_CONSOLE_DB_URL=${DB_URL}", "-DSATURN_CONSOLE_DB_USERNAME=${DB_USERNAME}", "-DSATURN_CONSOLE_DB_PASSWORD=${DB_PASSWORD}", "-Dsaturn.console.log=/app/logs/saturn_console", "-Xmx2G", "-Xms2G", "-XX:MaxMetaspaceSize=512M", "-XX:MetaspaceSize=512M", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+ParallelRefProcEnabled", "-XX:ErrorFile=/app/logs/saturn/hs_err_pid%p.log", "-XX:HeapDumpPath=/app/logs/saturn_console", "-XX:+HeapDumpOnOutOfMemoryError", "-jar", "saturn-console.jar"] |
This file contains hidden or 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
FROM openjdk:8-jdk-alpine | |
WORKDIR /app/deploy/ | |
COPY ./*.zip ./ | |
COPY ./start.sh ./ | |
RUN unzip *.zip \ | |
&& rm -rf *.zip \ | |
&& sed -i 's#bin/bash#bin/sh#' ./bin/*.sh | |
CMD ["./start.sh"] |
This file contains hidden or 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
#!/bin/sh | |
nohup ./bin/start.sh > /dev/null 2>&1 & | |
tail -f /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment