mirror of
https://github.com/twofas/2fas-server.git
synced 2024-11-24 03:10:00 +01:00
39 lines
1.5 KiB
YAML
39 lines
1.5 KiB
YAML
version: 0.2
|
|
|
|
env:
|
|
secrets-manager:
|
|
DOCKERHUB_USERNAME: hub.docker.com:username
|
|
DOCKERHUB_PASS: hub.docker.com:password
|
|
|
|
phases:
|
|
pre_build:
|
|
commands:
|
|
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
|
|
- REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME
|
|
- echo Logging in to Docker HUB to avoid rate limit
|
|
- echo "$DOCKERHUB_PASS" | docker login --username $DOCKERHUB_USERNAME --password-stdin
|
|
- echo Logging in to Amazon ECR
|
|
- 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
|
|
|
|
build:
|
|
commands:
|
|
- echo Build started on `date`
|
|
- echo Building the Docker image
|
|
- docker build -f docker/websocket/Dockerfile -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 latest, $IMAGE_TAG
|
|
- docker push $REPOSITORY_URI:latest
|
|
- docker push $REPOSITORY_URI:$IMAGE_TAG
|
|
- sed -i 's/<AWS_ACCOUNT_ID>/'$AWS_ACCOUNT_ID'/g' deployments/websocket/taskdef.json
|
|
- sed -i 's/<IMAGE_NAME>/'$AWS_ACCOUNT_ID'\.dkr\.ecr\.'$AWS_DEFAULT_REGION'\.amazonaws.com\/'$IMAGE_REPO_NAME'\:'$IMAGE_TAG'/g' deployments/websocket/taskdef.json
|
|
|
|
artifacts:
|
|
files:
|
|
- imageDetail.json
|
|
- deployments/websocket/appspec.yml
|
|
- deployments/websocket/taskdef.json
|