23
23
- service : api
24
24
runner : ubuntu-latest-8-cores
25
25
- service : client
26
- runner : blacksmith-32vcpu-ubuntu-2204
26
+ runner : ubuntu-latest-64-cores
27
27
- service : connection
28
28
runner : ubuntu-latest-8-cores
29
29
- service : files
@@ -47,81 +47,50 @@ jobs:
47
47
with :
48
48
aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID_DEVELOPMENT }}
49
49
aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY_DEVELOPMENT }}
50
- aws-region : us-east-1
50
+ aws-region : ${{ secrets.AWS_REGION }}
51
51
52
- - name : Login to Amazon ECR Public
52
+ - name : Login to Amazon ECR Private
53
53
id : login-ecr
54
54
uses : aws-actions/amazon-ecr-login@v2
55
- with :
56
- registry-type : public
57
55
58
56
- name : Define repository name
59
57
id : repo-name
60
58
run : |
61
59
echo "REPO_NAME=quadratic-${{ matrix.service }}-development" >> $GITHUB_OUTPUT
62
60
63
- - name : Create Public ECR Repository if not exists
61
+ - name : Create Private ECR Repository if not exists
64
62
id : create-ecr
65
63
env :
66
64
REPO_NAME : ${{ steps.repo-name.outputs.REPO_NAME }}
67
65
run : |
68
66
# Try to describe the repository first
69
- if ! aws ecr-public describe-repositories --repository-names $REPO_NAME 2>/dev/null; then
67
+ if ! aws ecr describe-repositories --repository-names $REPO_NAME 2>/dev/null; then
70
68
# Repository doesn't exist, create it
71
- aws ecr-public create-repository --repository-name $REPO_NAME
69
+ aws ecr create-repository --repository-name $REPO_NAME || true
72
70
fi
73
71
74
72
# Get the repository URI either way
75
- REPO_INFO=$(aws ecr-public describe-repositories --repository-names $REPO_NAME)
73
+ REPO_INFO=$(aws ecr describe-repositories --repository-names $REPO_NAME)
76
74
ECR_URL=$(echo $REPO_INFO | jq -r '.repositories[0].repositoryUri')
77
75
echo "ECR_URL=$ECR_URL" >> $GITHUB_OUTPUT
78
76
79
- # - name: Set up Docker Buildx
80
- # uses: docker/setup-buildx-action@v3
81
- # with:
82
- # buildkitd-flags: --debug
83
-
84
- # - name: Cache Docker layers
85
- # uses: actions/cache@v3
86
- # with:
87
- # path: /tmp/.buildx-cache
88
- # key: ${{ runner.os }}-buildx-${{ matrix.service }}-${{ github.sha }}
89
- # restore-keys: |
90
- # ${{ runner.os }}-buildx-${{ matrix.service }}-
91
- # ${{ runner.os }}-buildx-
92
-
93
- # - name: Create and initialize buildx cache
94
- # run: |
95
- # mkdir -p /tmp/.buildx-cache
96
- # CACHE_TAG="${{ runner.os }}-buildx-${{ matrix.service }}"
97
- # echo "{\"layers\":{},\"manifests\":{\"$CACHE_TAG\":{\"layers\":[]}}}" > /tmp/.buildx-cache/index.json
98
-
99
- # - name: Build, Tag, and Push Image to Amazon ECR Private
100
- # env:
101
- # ECR_URL: ${{ steps.create-ecr.outputs.ECR_URL }}
102
- # run: |
103
- # docker buildx build \
104
- # --cache-from=type=local,src=/tmp/.buildx-cache \
105
- # --cache-to=type=local,dest=/tmp/.buildx-cache-new \
106
- # --build-arg BUILD_TIME="${{ steps.build-metadata.outputs.BUILD_TIME }}" \
107
- # --build-arg GIT_SHA="${{ github.sha }}" \
108
- # --build-arg PR_NUMBER="${{ github.event.pull_request.number }}" \
109
- # --label "org.opencontainers.image.created=${{ steps.build-metadata.outputs.BUILD_TIME }}" \
110
- # --label "org.opencontainers.image.revision=${{ github.sha }}" \
111
- # --push \
112
- # -t $ECR_URL:pr-${{ github.event.pull_request.number }} \
113
- # -t $ECR_URL:${{ steps.build-metadata.outputs.BRANCH_NAME }} \
114
- # -t $ECR_URL:${{ steps.build-metadata.outputs.GIT_SHA_SHORT }} \
115
- # -f quadratic-${{ matrix.service }}/Dockerfile .
116
-
117
- # - name: Move cache
118
- # run: |
119
- # rm -rf /tmp/.buildx-cache
120
- # mv /tmp/.buildx-cache-new /tmp/.buildx-cache
77
+ - name : Set up Docker Buildx
78
+ uses : docker/setup-buildx-action@v3
79
+ with :
80
+ buildkitd-flags : --debug
121
81
122
- - name : Build, Tag, and Push Image to Amazon ECR Public
82
+ - name : Build, Tag, and Push Image to Amazon ECR Private
123
83
env :
124
84
ECR_URL : ${{ steps.create-ecr.outputs.ECR_URL }}
125
85
run : |
126
- docker build -t $ECR_URL:pr-${{ github.event.pull_request.number }} -f quadratic-${{ matrix.service }}/Dockerfile .
127
- docker push $ECR_URL:pr-${{ github.event.pull_request.number }}
86
+ docker buildx build \
87
+ --cache-from=type=registry,ref=$ECR_URL:buildcache \
88
+ --cache-to=type=registry,ref=$ECR_URL:buildcache,mode=max \
89
+ --build-arg BUILD_TIME="${{ steps.build-metadata.outputs.BUILD_TIME }}" \
90
+ --build-arg GIT_SHA="${{ github.sha }}" \
91
+ --build-arg PR_NUMBER="${{ github.event.pull_request.number }}" \
92
+ --label "org.opencontainers.image.created=${{ steps.build-metadata.outputs.BUILD_TIME }}" \
93
+ --label "org.opencontainers.image.revision=${{ github.sha }}" \
94
+ --push \
95
+ -t $ECR_URL:pr-${{ github.event.pull_request.number }} \
96
+ -f quadratic-${{ matrix.service }}/Dockerfile .
0 commit comments