Skip to content

Added dockerfile and docker-compose#6

Open
LujainaALMuharrami wants to merge 1 commit intoCodelineAtyab:mainfrom
LujainaALMuharrami:lujaina-almuharrami-containerize-app
Open

Added dockerfile and docker-compose#6
LujainaALMuharrami wants to merge 1 commit intoCodelineAtyab:mainfrom
LujainaALMuharrami:lujaina-almuharrami-containerize-app

Conversation

@LujainaALMuharrami
Copy link

@LujainaALMuharrami LujainaALMuharrami commented Jul 30, 2024

I’ve set up the app and database using Dockerfile and Docker Compose, and I use DbVisualizer to manage the MySQL database.

  • Dockerfile: Sets up the app environment.
  • Docker Compose: Manages both app and database containers.
  • DbVisualizer: Manage the MySQL database.

:))

Copy link
Owner

@CodelineAtyab CodelineAtyab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please respond to comments

COPY --from=build /app/target/rihal-0.0.1-SNAPSHOT.jar /app/rihal-0.0.1-SNAPSHOT.jar
EXPOSE 8080

ENTRYPOINT ["sh", "-c", "java -jar rihal-0.0.1-SNAPSHOT.jar"] No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any benefit of running java through "sh" and not directly using ENTRYPOINT ["java", "-jar", "/app/your-application.jar"] ?

WORKDIR /app
COPY pom.xml /app/
COPY src /app/src/
Run mvn clean package -DskipTests
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be RUN to make the case consistent with other keywords

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Target directory is meant for the machine the build is generated on. It should not be pushed to GitHub

environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3307/usersystem?useSSL=false&serverTimezone=UTC&createDatabaseIfNotExist=true&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: root
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should never push the password on GitHub.
Using the .env file can help solve this issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants