-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuildspec.yml
More file actions
36 lines (34 loc) · 1.34 KB
/
Copy pathbuildspec.yml
File metadata and controls
36 lines (34 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 211125520192.dkr.ecr.us-east-1.amazonaws.com
- echo Logging in to Docker Hub...
- >
docker login --username $(aws secretsmanager get-secret-value --secret-id docker-login --query SecretString --output text | jq -r '.username')
--password $(aws secretsmanager get-secret-value --secret-id docker-login --query SecretString --output text | jq -r '.password')
- REPOSITORY_URI=211125520192.dkr.ecr.us-east-1.amazonaws.com/demo-drn-docker
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
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:latest
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push $REPOSITORY_URI:$IMAGE_TAG
- docker push $REPOSITORY_URI:latest
- ls -al # Lists the current directory structure; adjust the path as needed
artifacts:
files:
- "**/*"
- Dockerfile
- app/build/**
discard-paths: no
cache:
paths:
- "node_modules/**/*"