Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit feaf95a

Browse files
update entrypoint config
1 parent 8f942ff commit feaf95a

File tree

4 files changed

+57
-3
lines changed

4 files changed

+57
-3
lines changed

‎.env/docker-entrypoint.d/hello.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
echo "Hello, World!"

‎Dockerfile‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
FROM openjdk:8
22
LABEL author="netbuffer" version="1.0"
3+
COPY help/docker-entrypoint.sh /
4+
RUN mkdir /docker-entrypoint.d
5+
ENTRYPOINT ["/docker-entrypoint.sh"]
36
WORKDIR /
47
ENV JAVA_OPTS=
5-
ADD target/spring-boot-demo.jar /
8+
ADD target/*.jar /app.jar
69
EXPOSE 9100
7-
ENTRYPOINT java ${JAVA_OPTS} -jar /spring-boot-demo.jar
10+
CMD java ${JAVA_OPTS} -jar /app.jar

‎docker-compose.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ services:
1010
cn.netbuffer.springboot.demo.author: "netbuffer"
1111
cn.netbuffer.springboot.demo.label-with-empty-value: ""
1212
image: netbuffer/spring-boot-demo:1.0
13+
container_name: spring-boot-demo-container
14+
hostname: spring-boot-demo
1315
ports:
1416
- "9100:9100"
1517
mem_swappiness: 70
@@ -22,5 +24,6 @@ services:
2224
environment:
2325
TZ: Asia/Shanghai
2426
JAVA_OPTS: -Xms4g -Xmx8g
25-
container_name: spring-boot-demo-container
2627
restart: "no"
28+
volumes:
29+
- .env/docker-entrypoint.d/:/docker-entrypoint.d

‎help/docker-entrypoint.sh‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/sh
2+
# vim:sw=4:ts=4:et
3+
4+
set -e
5+
6+
entrypoint_log() {
7+
if [ -z "${SBD_APP_ENTRYPOINT_QUIET_LOGS:-}" ]; then
8+
echo "$@"
9+
fi
10+
}
11+
12+
if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -maxdepth 1 -type f -print -quit 2>/dev/null | read v; then
13+
entrypoint_log "0ドル: /docker-entrypoint.d/ is not empty, will attempt to perform configuration"
14+
15+
entrypoint_log "0ドル: Looking for shell scripts in /docker-entrypoint.d/"
16+
find "/docker-entrypoint.d/" -follow -type f -print | sort -V | while read -r f; do
17+
case "$f" in
18+
*.envsh)
19+
if [ -x "$f" ]; then
20+
entrypoint_log "0ドル: Sourcing $f";
21+
. "$f"
22+
else
23+
# warn on shell scripts without exec bit
24+
entrypoint_log "0ドル: Ignoring $f, not executable";
25+
fi
26+
;;
27+
*.sh)
28+
if [ -x "$f" ]; then
29+
entrypoint_log "0ドル: Launching $f";
30+
"$f"
31+
else
32+
# warn on shell scripts without exec bit
33+
entrypoint_log "0ドル: Ignoring $f, not executable";
34+
fi
35+
;;
36+
*) entrypoint_log "0ドル: Ignoring $f";;
37+
esac
38+
done
39+
40+
entrypoint_log "0ドル: Configuration complete; ready for start up"
41+
else
42+
entrypoint_log "0ドル: No files found in /docker-entrypoint.d/, skipping configuration"
43+
fi
44+
45+
exec "$@"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /