Skip to content

Java sample project with Gradle, SpringBoot and Docker

Notifications You must be signed in to change notification settings

DevSecOpsSamples/java-gradle

Repository files navigation

SpringBoot sample docker image

Quality Gate Status Lines of Code

@RequestMapping(value="/", method=RequestMethod.GET)
@RequestMapping(value="/ping", method=RequestMethod.GET)

AWS

ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
REGION=$(aws configure get default.region)

echo "ACCOUNT_ID: $ACCOUNT_ID"
echo "REGION: $REGION"
sleep 1

docker build -t java-gradle . --platform linux/amd64

aws ecr create-repository --repository-name java-gradle --image-scanning-configuration scanOnPush=true --region $REGION

docker tag java-gradle:latest ${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/java-gradle:latest

aws ecr get-login-password --region ${REGION} | docker login --username AWS --password-stdin ${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com

docker push ${ACCOUNT_ID}.dkr.ecr.${REGION}.amazonaws.com/java-gradle:latest

GCP

COMPUTE_ZONE="us-central1"
PROJECT_ID="sample-project" # replace with your project
echo "PROJECT_ID: ${PROJECT_ID}"

docker build -t java-gradle . --platform linux/amd64
docker tag java-gradle:latest gcr.io/${PROJECT_ID}/java-gradle:latest

gcloud auth configure-docker
docker push gcr.io/${PROJECT_ID}/java-gradle:latest

About

Java sample project with Gradle, SpringBoot and Docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published