|
| 1 | +# SPC-006-T2 - Test All Service Images Build Successfully and Push to ECR |
| 2 | + |
| 3 | +## Objective |
| 4 | + |
| 5 | +Build, tag, and push Spring PetClinic microservice Docker images to AWS Elastic Container Registry (ECR) using Git commit SHA tags. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Branch Name |
| 10 | + |
| 11 | +`SPC-006-T2-ecr-push` |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Git Commit SHA |
| 16 | + |
| 17 | +`df1e36e` |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +# Maven Build Process |
| 22 | + |
| 23 | +The following command was used to build all Docker images locally: |
| 24 | + |
| 25 | +```bash |
| 26 | +./mvnw clean install -P buildDocker -DskipTests |
| 27 | +``` |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +# Docker Images Verification |
| 34 | + |
| 35 | +Verified generated Docker images locally using: |
| 36 | + |
| 37 | +```bash |
| 38 | +docker images |
| 39 | +``` |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +# AWS ECR Authentication |
| 46 | + |
| 47 | +Authenticated Docker to AWS ECR using AWS CLI: |
| 48 | + |
| 49 | +```bash |
| 50 | +aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 338593158888.dkr.ecr.us-east-1.amazonaws.com |
| 51 | +``` |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | +# AWS ECR Repository Verification |
| 56 | + |
| 57 | +Verified repositories successfully created in AWS ECR. |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +# Successfully Pushed Services |
| 64 | + |
| 65 | +## API Gateway |
| 66 | + |
| 67 | +Repository: |
| 68 | + |
| 69 | +```text |
| 70 | +spring-petclinic/api-gateway |
| 71 | +``` |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## Customers Service |
| 78 | + |
| 79 | +Repository: |
| 80 | + |
| 81 | +```text |
| 82 | +spring-petclinic/customers-service |
| 83 | +``` |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +## Vets Service |
| 90 | + |
| 91 | +Repository: |
| 92 | + |
| 93 | +```text |
| 94 | +spring-petclinic/vets-service |
| 95 | +``` |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## Visits Service |
| 102 | + |
| 103 | +Repository: |
| 104 | + |
| 105 | +```text |
| 106 | +spring-petclinic/visits-service |
| 107 | +``` |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## Config Server |
| 114 | + |
| 115 | +Repository: |
| 116 | + |
| 117 | +```text |
| 118 | +spring-petclinic/config-server |
| 119 | +``` |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## Discovery Server |
| 126 | + |
| 127 | +Repository: |
| 128 | + |
| 129 | +```text |
| 130 | +spring-petclinic/discovery-server |
| 131 | +``` |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +## Admin Server |
| 138 | + |
| 139 | +Repository: |
| 140 | + |
| 141 | +```text |
| 142 | +spring-petclinic/admin-server |
| 143 | +``` |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## GenAI Service |
| 150 | + |
| 151 | +Repository: |
| 152 | + |
| 153 | +```text |
| 154 | +spring-petclinic/genai-service |
| 155 | +``` |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +# Steps Performed |
| 162 | + |
| 163 | +1. Cloned the repository |
| 164 | +2. Used feature branch: |
| 165 | + `SPC-006-T2-ecr-push` |
| 166 | +3. Built Docker images using Maven |
| 167 | +4. Generated Git commit SHA |
| 168 | +5. Configured AWS CLI |
| 169 | +6. Authenticated Docker with AWS ECR |
| 170 | +7. Tagged Docker images |
| 171 | +8. Pushed images to official team ECR repositories |
| 172 | +9. Verified image uploads in AWS ECR |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +# Challenges Encountered |
| 177 | + |
| 178 | +- Initial ECR authentication issue |
| 179 | +- Repository naming mismatch |
| 180 | +- Missing repositories during first push attempt |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +# Resolution |
| 185 | + |
| 186 | +- Re-authenticated Docker using AWS CLI |
| 187 | +- Switched to official team ECR repositories: |
| 188 | + `spring-petclinic/<service-name>` |
| 189 | +- Re-tagged and re-pushed images successfully |
| 190 | + |
| 191 | +--- |
| 192 | + |
| 193 | +# Outcome |
| 194 | + |
| 195 | +Successfully built, tagged, pushed, and verified Spring PetClinic microservice Docker images in AWS Elastic Container Registry (ECR) using Git commit SHA tags. |
| 196 | + |
| 197 | +All required backend microservice images were successfully uploaded to the official team repositories. |
0 commit comments