Skip to content

Commit 1af7354

Browse files
committed
ci: Add build SHA to health check for deployment verification
1 parent 083b763 commit 1af7354

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

.github/workflows/aws-backend-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
--cache-from type=gha \
7171
--cache-to type=gha,mode=max \
7272
--push \
73+
--build-arg BUILD_SHA=$IMAGE_TAG \
7374
-f ${{ env.DOCKERFILE }} \
7475
-t $ECR_REGISTRY/$ECR_REPOSITORY:latest \
7576
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \

backend/Dockerfile.prod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ USER node
1212
WORKDIR /srv/backend
1313
COPY --from=api-builder /srv/backend/node_modules ./node_modules
1414
COPY . .
15+
ENV BUILD_SHA=${BUILD_SHA}
1516
CMD ["npm", "run", "start"]
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const HealthCheckController = {};
22

33
HealthCheckController.isAlive = (_, res) => {
4-
res.status(200).send("I'm Alive!");
5-
}
4+
res
5+
.status(200)
6+
.send(`I'm Alive! Build: ${process.env.BUILD_SHA || 'unknown'} - ${new Date().toISOString()}`);
7+
};
68

79
module.exports = HealthCheckController;

0 commit comments

Comments
 (0)