From 6cca6a67c21f80d501165d997ae29a9c169a7f73 Mon Sep 17 00:00:00 2001 From: Achyuth varma <147799588+Achyuthvarma99@users.noreply.github.com> Date: Wed, 28 Aug 2024 16:44:28 +0530 Subject: [PATCH 1/3] Create buildspec.yml --- buildspec.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 buildspec.yml diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 0000000..fbb7605 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,25 @@ +version: 0.2 + +phases: + pre_build: + commands: + - echo Logging in to Amazon ECR... + - aws --version + - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com + - REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME + build: + commands: + - echo Build started on `date` + - echo Building the Docker image... + - docker build -t $REPOSITORY_URI:$IMAGE_TAG . + - docker tag $REPOSITORY_URI:$IMAGE_TAG $REPOSITORY_URI:$IMAGE_TAG + post_build: + commands: + - echo Build completed on `date` + - echo Pushing the Docker images... + - docker push $REPOSITORY_URI:$IMAGE_TAG + - echo Writing image definitions file... + - printf '[{"name":"%s","imageUri":"%s"}]' $CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json + +artifacts: + files: imagedefinitions.json From 44c1366d41127a01182c8cd30aa9c18d3991680c Mon Sep 17 00:00:00 2001 From: Achyuth varma <147799588+Achyuthvarma99@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:13:22 +0530 Subject: [PATCH 2/3] Create Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ + From 8be8881d6f617d21856ce4463bf2eed4328e779a Mon Sep 17 00:00:00 2001 From: Achyuth varma <147799588+Achyuthvarma99@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:15:06 +0530 Subject: [PATCH 3/3] Update Dockerfile --- Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Dockerfile b/Dockerfile index 8b13789..42e2282 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1,13 @@ +FROM node:alpine +WORKDIR /nodejs-ci-cd-pipeline + +COPY package.json . + +RUN npm install + +COPY . . + +EXPOSE 3000 + +CMD [ "node", "app.js" ]