Skip to content

Add Feature Docker support and externalize config via environment#9

Open
sidhantmourya wants to merge 2 commits into
anmol111pal:mainfrom
sidhantmourya:main
Open

Add Feature Docker support and externalize config via environment#9
sidhantmourya wants to merge 2 commits into
anmol111pal:mainfrom
sidhantmourya:main

Conversation

@sidhantmourya
Copy link
Copy Markdown

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.

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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 of localhost to 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}
Copy link

Copilot AI Jul 6, 2025

Choose a reason for hiding this comment

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

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}

Copilot uses AI. Check for mistakes.
Comment thread Dockerfile Outdated

COPY target/course-app-0.0.1-SNAPSHOT.jar course-app.jar

EXPOSE 8081
Copy link

Copilot AI Jul 6, 2025

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
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