Skip to content

Commit 38f270c

Browse files
feat(spring-oracle-example): add custom entrypoint script and remove restart policy from compose
1 parent 866b5bf commit 38f270c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

spring-oracle-example/Dockerfile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,15 @@ RUN java -Djarmode=layertools -jar target/app.jar extract --destination target/e
2727
FROM eclipse-temurin:21-jre-jammy AS final
2828

2929
ARG UID=10001
30-
RUN adduser \
31-
--disabled-password \
32-
--gecos "" \
33-
--home "/nonexistent" \
34-
--shell "/sbin/nologin" \
35-
--no-create-home \
36-
--uid "${UID}" \
37-
appuser
38-
USER appuser
3930

4031
COPY --from=extract build/target/extracted/dependencies/ ./
4132
COPY --from=extract build/target/extracted/spring-boot-loader/ ./
4233
COPY --from=extract build/target/extracted/snapshot-dependencies/ ./
4334
COPY --from=extract build/target/extracted/application/ ./
4435

36+
COPY docker/java/entrypoint.sh /entrypoint.sh
37+
RUN chmod +x /entrypoint.sh
38+
4539
EXPOSE 8080
4640

47-
ENTRYPOINT [ "java", "org.springframework.boot.loader.launch.JarLauncher" ]
41+
ENTRYPOINT ["/entrypoint.sh"]

spring-oracle-example/compose.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ services:
33
app:
44
build:
55
context: .
6-
restart: unless-stopped
76
depends_on:
87
- oracle-db
98
environment:
@@ -22,7 +21,6 @@ services:
2221
oracle-db:
2322
image: gvenzl/oracle-xe:21-slim
2423
container_name: oracle-xe
25-
restart: unless-stopped
2624
ports:
2725
- "1521:1521"
2826
environment:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
# entrypoint.sh
3+
4+
echo "Aguardando 30 segundos..."
5+
sleep 30
6+
7+
echo "Iniciando a aplicação..."
8+
exec java org.springframework.boot.loader.launch.JarLauncher

0 commit comments

Comments
 (0)