-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuildspec.yaml
69 lines (64 loc) · 3.13 KB
/
buildspec.yaml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Do not change version. This is the version of aws buildspec, not the version of your buildspec file.
version: 0.2
env:
shell: bash
variables:
PROJECT: 'filecoin'
SUB_ENV: 'glif'
SHORT_REGION: 'apn1'
ENVIRONMENT: 'dev'
DOCKERHUB_ORGANIZATION: 'protofire'
HELM_VERSION: 'v3.1.0'
DOCKERHUB_REPO_NAME: 'cid-checker'
APP_VERSION: '0.1.36'
NETWORK: 'calibration'
ARCH: 'amd64'
DOCKER_BUILDX_VERSION: 'v0.10.4'
secrets-manager:
DOCKERHUB_USERNAME: "filecoin-mainnet-apn1-glif-dockerhub-glifio:username"
DOCKERHUB_PASS: "filecoin-mainnet-apn1-glif-dockerhub-glifio:password"
AWS_ACCESS_KEY_ID: "filecoin-dev-apn1-glif-codebuild-user:AWS_ACCESS_KEY_ID"
AWS_SECRET_ACCESS_KEY: "filecoin-dev-apn1-glif-codebuild-user:AWS_SECRET_ACCESS_KEY"
phases:
install:
commands:
- echo Environment Variables
- printenv
- echo Logging to AWS eks
- aws eks --region $AWS_REGION update-kubeconfig --name $PROJECT-$ENVIRONMENT-$SHORT_REGION-$SUB_ENV-eks
- echo Installing Helm
- wget https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz
- tar -xzvf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz
- chmod +x ./linux-${ARCH}/helm
- mv ./linux-${ARCH}/helm /usr/bin/helm
pre_build:
commands:
- echo Build STARTED
- docker login --username $DOCKERHUB_USERNAME --password $DOCKERHUB_PASS
- echo Install buildx plugin
- curl -JLO https://github.com/docker/buildx/releases/download/${DOCKER_BUILDX_VERSION}/buildx-${DOCKER_BUILDX_VERSION}.linux-amd64
- mkdir -p ~/.docker/cli-plugins
- mv buildx-${DOCKER_BUILDX_VERSION}.linux-amd64 ~/.docker/cli-plugins/docker-buildx
- chmod a+rx ~/.docker/cli-plugins/docker-buildx
#
- echo Install binfmt tool
- docker run --privileged --rm tonistiigi/binfmt --install all
#
- echo Install QEMU and binfmt_misc tools
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
#
- echo Configure Docker buildx builder
- docker buildx create --use --name nethermind
- docker buildx inspect --bootstrap
build:
commands:
- echo Building docker images
- docker buildx build --push --platform linux/amd64,linux/arm64 -t $DOCKERHUB_ORGANIZATION/$DOCKERHUB_REPO_NAME:$APP_VERSION-s3-sort-caching-multi -f Dockerfile.s3-sort-caching .
- docker buildx build --push --platform linux/amd64,linux/arm64 -t $DOCKERHUB_ORGANIZATION/$DOCKERHUB_REPO_NAME:$APP_VERSION-backend-multi -f Dockerfile.backend .
- docker buildx build --push --platform linux/amd64,linux/arm64 -t $DOCKERHUB_ORGANIZATION/$DOCKERHUB_REPO_NAME:$APP_VERSION-watcher-multi -f Dockerfile.watcher .
- docker buildx build --push --platform linux/amd64,linux/arm64 -t $DOCKERHUB_ORGANIZATION/$DOCKERHUB_REPO_NAME:$APP_VERSION-frontend-multi -f Dockerfile.frontend --build-arg REACT_APP_FILECOIN_CID_CHECKER_API=/api .
- cd helm
- sed -i "s/0.0.0/${APP_VERSION}/g" Chart.yaml
- helm lint
- helm template cid-checker-$NETWORK . -f env-values/$NETWORK.yaml
- helm upgrade --install cid-checker-$NETWORK . -f env-values/$NETWORK.yaml