Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codebuild pipeline #1

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
39 changes: 0 additions & 39 deletions .github/workflows/main.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use an official Node.js LTS (Long Term Support) image as the base image
FROM node:20-alpine
FROM node:20

# Set the working directory inside the container
WORKDIR /usr/src/app
Expand Down
22 changes: 12 additions & 10 deletions Dockerrun.aws.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "600453241670.dkr.ecr.us-east-1.amazonaws.com/next-docker:next-docker"
},
"Ports": [
{
"ContainerPort": 3000
}
]
}
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "600453241670.dkr.ecr.us-east-1.amazonaws.com/next-docker:latest",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "3000",
"HostPort": "3000"
}
]
}
29 changes: 29 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 0.2

phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 600453241670.dkr.ecr.us-east-1.amazonaws.com
- REPOSITORY_URI=600453241670.dkr.ecr.us-east-1.amazonaws.com/next-docker
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":next-docker","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json

artifacts:
files:
- imagedefinitions.json
48 changes: 0 additions & 48 deletions docker-compose.yml

This file was deleted.