{"id":21869673,"url":"https://github.com/anirudhsharma777/dockerize_springboot_starter_package","last_synced_at":"2026-04-13T14:31:57.794Z","repository":{"id":264769581,"uuid":"857323043","full_name":"AnirudhSharma777/Dockerize_SpringBoot_Starter_Package","owner":"AnirudhSharma777","description":"This is a Starter Package for those Developer who might facing issue with the setup process. So They can use this instead of setup all these ","archived":false,"fork":false,"pushed_at":"2024-09-14T16:39:49.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-07T04:38:46.594Z","etag":null,"topics":["docker-compose","docker-image","java","maven","postgresql","sping-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnirudhSharma777.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-14T10:52:31.000Z","updated_at":"2024-10-20T10:41:00.000Z","dependencies_parsed_at":"2024-11-26T08:36:44.994Z","dependency_job_id":"400e0203-8df8-4076-8841-9f2d24a2e171","html_url":"https://github.com/AnirudhSharma777/Dockerize_SpringBoot_Starter_Package","commit_stats":null,"previous_names":["anirudhsharma777/dockerize_springboot_starter_package"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AnirudhSharma777/Dockerize_SpringBoot_Starter_Package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhSharma777%2FDockerize_SpringBoot_Starter_Package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhSharma777%2FDockerize_SpringBoot_Starter_Package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhSharma777%2FDockerize_SpringBoot_Starter_Package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhSharma777%2FDockerize_SpringBoot_Starter_Package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnirudhSharma777","download_url":"https://codeload.github.com/AnirudhSharma777/Dockerize_SpringBoot_Starter_Package/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhSharma777%2FDockerize_SpringBoot_Starter_Package/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722728,"owners_count":26034461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","docker-image","java","maven","postgresql","sping-boot"],"created_at":"2024-11-28T06:08:43.419Z","updated_at":"2025-10-07T04:38:46.835Z","avatar_url":"https://github.com/AnirudhSharma777.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Dockerized Spring Boot Starter Pack with PostgreSQL\n\nThis project is a basic template to get started with a Dockerized Spring Boot application that connects to a PostgreSQL database.\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed on your machine:\n\n- **Java 17** (or any supported version)\n- **Maven** (for building the Spring Boot app)\n- **Docker** and **Docker Compose**\n\n## Project Structure\n\n```\n├── Dockerfile\n├── docker-compose.yml\n├── src\n│   ├── main\n│   │   ├── java\n│   │   └── resources\n├── pom.xml\n└── README.md\n```\n\n- **Dockerfile**: Defines how the Spring Boot app is packaged into a Docker container.\n- **docker-compose.yml**: Defines and orchestrates the Spring Boot application and PostgreSQL database services.\n- **src**: The source code of your Spring Boot application.\n- **pom.xml**: Maven configuration file for managing dependencies and build processes.\n\n## How to Build and Run the Project\n\n### Step 1: Build the Spring Boot Application\n\nFirst, package your Spring Boot application into a JAR file by running the following Maven command:\n\n```bash\nmvn clean package -DskipTests\n```\n\nThis will generate a JAR file in the `target/` directory.\n\n### Step 2: Run Docker Compose\n\nTo run the Spring Boot application and PostgreSQL using Docker, use the following command:\n\n```bash\ndocker-compose up --build\n```\n\nThis will:\n- Build the Docker image for the Spring Boot application using the `Dockerfile`.\n- Start up the Spring Boot app and PostgreSQL database services defined in `docker-compose.yml`.\n\n### Step 3: Access the Application\n\nOnce the containers are running, the Spring Boot application will be accessible at:\n\n```\nhttp://localhost:8080\n```\n\n### Step 4: Stop the Containers\n\nTo stop the running containers, use:\n\n```bash\ndocker-compose down\n```\n\nThis will stop and remove all the containers, networks, and volumes defined in the `docker-compose.yml`.\n\n## Configuration\n\n### Dockerfile\n\nThe `Dockerfile` is used to build the Docker image for the Spring Boot app. Here's a sample `Dockerfile`:\n\n```dockerfile\n# Use an official OpenJDK runtime as a parent image\nFROM openjdk:17-jdk-alpine\n\n# Set the working directory inside the container\nWORKDIR /app\n\n# Copy the jar file into the container at /app\nCOPY target/your-app-name.jar app.jar\n\n# Expose port 8080 to the outside world\nEXPOSE 8080\n\n# Run the jar file\nENTRYPOINT [\"java\", \"-jar\", \"app.jar\"]\n```\n\nMake sure to replace `your-app-name.jar` with the actual JAR file name generated in the `target` directory after running `mvn clean package`.\n\n### docker-compose.yml\n\nThe `docker-compose.yml` file orchestrates the Spring Boot app and PostgreSQL services.\n\n```yaml\nversion: '3.8'\n\nservices:\n  java_app:\n    image: your-app-name\n    build:\n      context: .\n      dockerfile: Dockerfile\n    ports:\n      - \"8080:8080\"\n    environment:\n      SPRING_DATASOURCE_URL: jdbc:postgresql://java_db:5432/postgresdb\n      SPRING_DATASOURCE_USERNAME: postgres\n      SPRING_DATASOURCE_PASSWORD: postgres\n    depends_on:\n      - java_db\n\n  java_db:\n    image: postgres:latest\n    environment:\n      POSTGRES_USER: postgres\n      POSTGRES_PASSWORD: postgres\n      POSTGRES_DB: postgresdb\n    ports:\n      - \"5432:5432\"\n    volumes:\n      - pgdata:/var/lib/postgresql/data\n\nvolumes:\n  pgdata:\n```\n\n### Application Properties for PostgreSQL\n\nIn your `application.properties` or `application.yml` file, make sure to configure the database connection like this:\n\n```properties\nspring.datasource.url=${SPRING_DATASOURCE_URL}\nspring.datasource.username=${SPRING_DATASOURCE_USERNAME}\nspring.datasource.password=${SPRING_DATASOURCE_PASSWORD}\n\nspring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect\nspring.jpa.hibernate.ddl-auto=update\n```\n\nThese environment variables are passed in the `docker-compose.yml` file to ensure PostgreSQL connectivity.\n\n## How to Push Docker Image to Docker Hub (Optional)\n\n1. Tag your Docker image:\n   ```bash\n   docker tag your-app-name your-dockerhub-username/your-repository-name:tag\n   ```\n\n2. Push the image to Docker Hub:\n   ```bash\n   docker push your-dockerhub-username/your-repository-name:tag\n   ```\n\n## Troubleshooting\n\n- **Port Conflict**: If port `8080` or `5432` is already in use, stop any running services using those ports or change the ports in `docker-compose.yml`.\n- **Database Connection Issues**: Make sure the PostgreSQL service is running and the database credentials in the `docker-compose.yml` and `application.properties` are correct.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanirudhsharma777%2Fdockerize_springboot_starter_package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanirudhsharma777%2Fdockerize_springboot_starter_package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanirudhsharma777%2Fdockerize_springboot_starter_package/lists"}