-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec-platform.yml
More file actions
34 lines (31 loc) · 1.69 KB
/
buildspec-platform.yml
File metadata and controls
34 lines (31 loc) · 1.69 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
version: 0.2
env:
shell: /bin/bash
parameter-store:
DOCKERHUB_PASSWORD: /prod/sharedInfrastructure/dockerhub/password
DOCKERHUB_USERNAME: /prod/sharedInfrastructure/dockerhub/username
phases:
install:
commands:
- if [ -z ${AWS_ACCOUNT_ID+x} ]; then AWS_ACCOUNT_ID=$(aws sts get-caller-identity | jq -r .Account); fi
- REGISTRY_URI=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION:-$AWS_DEFAULT_REGION}.amazonaws.com/
- DH_REPO=${REGISTRY_URI}docker-hub
- aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin ${REGISTRY_URI}
- export BUILDX_VERSION=$(curl --silent "https://api.github.com/repos/docker/buildx/releases/latest" | jq -r .tag_name)
- curl -JLO --retry 5 --retry-max-time 120 "https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.linux-${ARCH:-amd64}"
- mkdir -p ~/.docker/cli-plugins
- mv "buildx-$BUILDX_VERSION.linux-${ARCH:-amd64}" ~/.docker/cli-plugins/docker-buildx
- chmod +x ~/.docker/cli-plugins/docker-buildx
build:
commands:
- echo Logging in to Docker Hub...
- docker login --username $DOCKERHUB_USERNAME --password $DOCKERHUB_PASSWORD
- echo Logging in to ECR...
- aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin ${REGISTRY_URI}
- echo "Build started on `date` ($(git rev-parse HEAD | cut -c -8))"
- echo Building the Docker image...
- echo Using base image ${DH_REPO}/library/php
- docker buildx bake --provenance=false --progress=plain --set 'php*.args.BASE_IMAGE'=${DH_REPO}/library/php --push
post_build:
commands:
- echo Build completed at `date`