-
Notifications
You must be signed in to change notification settings - Fork 145
/
buildspec.yml
26 lines (26 loc) · 956 Bytes
/
buildspec.yml
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
version: 0.2
#Generic buildspec file for AWS Codebuild
#Works for both ARM and AMD builds
env:
secrets-manager:
DOCKERHUB_PASS: "/dockerhub/credentials:password"
DOCKERHUB_USERNAME: "/dockerhub/credentials:username"
phases:
install:
commands:
- yum update -y
pre_build:
commands:
- echo Logging in to DOCKER...
- docker login --username $DOCKERHUB_USERNAME --password $DOCKERHUB_PASS
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- VERSION=$(cat version.txt)
- docker build -t $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$VERSION-$ARCH -t $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME:$IMAGE_TAG-$ARCH .
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push $DOCKERHUB_USERNAME/$IMAGE_REPO_NAME --all-tags