{"id":21734144,"url":"https://github.com/abhishekomp/product-service-docker-postgres","last_synced_at":"2026-04-09T09:50:14.614Z","repository":{"id":254068909,"uuid":"845226759","full_name":"abhishekomp/product-service-docker-postgres","owner":"abhishekomp","description":"Spring Boot app in Docker with Postgres also in Docker. Uses TestContainer for testing.","archived":false,"fork":false,"pushed_at":"2024-09-03T17:51:18.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-25T20:41:38.726Z","etag":null,"topics":["testcontainer"],"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/abhishekomp.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-08-20T20:49:24.000Z","updated_at":"2024-09-03T17:52:10.000Z","dependencies_parsed_at":"2025-01-25T20:51:39.931Z","dependency_job_id":null,"html_url":"https://github.com/abhishekomp/product-service-docker-postgres","commit_stats":null,"previous_names":["abhishekomp/product-service-docker-postgres"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhishekomp%2Fproduct-service-docker-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhishekomp%2Fproduct-service-docker-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhishekomp%2Fproduct-service-docker-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abhishekomp%2Fproduct-service-docker-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abhishekomp","download_url":"https://codeload.github.com/abhishekomp/product-service-docker-postgres/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244711968,"owners_count":20497418,"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","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":["testcontainer"],"created_at":"2024-11-26T05:08:03.427Z","updated_at":"2025-12-31T00:03:46.348Z","avatar_url":"https://github.com/abhishekomp.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Create Docker Image of your Spring Boot app.\n# Run your Spring Boot application in Docker container and connect to Postgres in Docker.\n\n- This project demonstrates starting a Spring Boot app in a docker container.  \n- It uses Docker compose to run the Spring Boot app connected to Postgres DB with all of these running in their own separate containers.\n\n# Updated Simple Steps to run the project\nStep 0: Make sure docker is installed and running.  \nStep 1: Set the environment variable for Postgres DB password like this  \n`export POSTGRES_DB_PWD=admin`  \nStep 2: Run docker compose up:  \n`docker compose -f ./docker-compose.yaml up`\n- Note: The updated DockerFile has multi-stage build that produces the jar file to be used by docker compose\n\n# (Deprecated) Steps to run the project\nStep 0: Make sure docker is installed and running.  \nStep 1: Build the project to create the .jar file (`./mvnw clean package -DskipTests`) (If needed, `chmod +x mvnw`)  \nStep 2: Set the environment variable for Postgres DB password like this  \n`export POSTGRES_DB_PWD=admin`   \nStep 3: Run docker compose up:  \n`docker compose -f ./docker-compose.yaml up`  \nStep 4: Use tool like Postman to send request to the end-point for creating product record and viewing product record:  \nhttp://localhost:8081/product-service/addProduct  \nhttp://localhost:8081/product-service/getAllProducts  \nhttp://localhost:8081/product-service/getProduct/1\n\n## Some important commands\n- Get inside a Docker container's terminal \n`docker exec -it \u003ccontainer_name or id\u003e /bin/bash`\n- `psql -U postgres`: To start psql for Postgres once inside the container.\n- CLI commands for Postgres: `\\l` to see the databases, `\\c` to connect to a specific database, `\\dt` to see the tables\n- Up docker containers/services  \n  `docker compose up -d` (use without -d if you need to see the logs)  \n  `docker compose -f ./docker-compose.yaml up`\n- Down the docker containers/services  \n  `docker compose down`\n- Build docker image of your Spring boot app using Dockerfile  \n  `docker build -t docker-springboot:1 .`\n- Run your newly created image in docker  \n  `docker run -p 8081:8081 docker-springboot:1`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhishekomp%2Fproduct-service-docker-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhishekomp%2Fproduct-service-docker-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhishekomp%2Fproduct-service-docker-postgres/lists"}