Add Feature Docker support and externalize config via environment#9
Open
sidhantmourya wants to merge 2 commits into
Open
Add Feature Docker support and externalize config via environment#9sidhantmourya wants to merge 2 commits into
sidhantmourya wants to merge 2 commits into
Conversation
Introduced Dockerfile and docker-compose.yml for containerized deployment, including a MySQL service. Updated application.properties to use environment variables for configuration, enabling easier deployment and configuration management.
There was a problem hiding this comment.
Pull Request Overview
Adds containerization support with Docker and externalizes application configuration via environment variables for easier deployment management.
- Externalize Spring configuration properties to environment variables
- Introduce Dockerfile for building the application image
- Add docker-compose setup including MySQL service and network
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/resources/application.properties | Switched hard-coded Spring properties to use ${…} env variables |
| docker/docker-compose.yml | Defined course-app and mysql-db services with environment-driven config |
| Dockerfile | Created image build steps and entrypoint for container |
Comments suppressed due to low confidence (1)
docker/docker-compose.yml:13
- Use the MySQL service hostname (
mysql-db) instead oflocalhostto ensure the application container can resolve and connect to the database.
SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/course-app-api
| server.port=8000 | ||
|
|
||
| spring.datasource.name=course-app-api | ||
| spring.datasource.name= ${SPRING_DATASOURCE_NAME} |
There was a problem hiding this comment.
Remove the unintended leading space after = so the environment variable value isn't prefixed with a space.
Suggested change
| spring.datasource.name= ${SPRING_DATASOURCE_NAME} | |
| spring.datasource.name=${SPRING_DATASOURCE_NAME} |
|
|
||
| COPY target/course-app-0.0.1-SNAPSHOT.jar course-app.jar | ||
|
|
||
| EXPOSE 8081 |
There was a problem hiding this comment.
The exposed port 8081 does not match the 8080 port mapping in docker-compose. Align these (e.g., expose 8080) to avoid connectivity issues.
Suggested change
| EXPOSE 8081 | |
| EXPOSE 8080 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduced Dockerfile and docker-compose.yml for containerized deployment, including a MySQL service. Updated application.properties to use environment variables for configuration, enabling easier deployment and configuration management.