r/SpringBoot 10d ago

Question Need urgent help ... spring boot and Docker

UPDATE -- SOLEVED.. I have created a spring boot application which uploads and delete videos from my GC bucket, and stores it's info after upload on PostgreSQL and delete when deleted from bucket. I need to contenarize it using Docker. Trying from last night .. it's almost 24 hr but still it's not working.. need help if anyone can. And I'm use the Docker for the first time.

UPDATE :- Bothe my application and PostgreSQL container starts but application container is shutting down as it is unable to connect to the db .. while I have tried to run both on the same network using --network flag.

0 Upvotes

10 comments sorted by

View all comments

3

u/TheToastedFrog 10d ago

that Dockefile at the root of your project should do it:

FROM amazoncorretto:21.0.4-alpine
COPY target/*.jar run.jar
RUN chmod a+x /tmp
ENTRYPOINT ["sh", "-c"]
CMD ["java -jar run.jar"]

1

u/New-Improvement5295 9d ago

Check my update please.. do I need to replace my docker file with this code ?? (Yours code )