Skip to content

Commit dc0ccbb

Browse files
committed
devops: using buildx to cache better?
1 parent e0a64fa commit dc0ccbb

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

.github/workflows/push-docker.yml

+30-20
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,29 @@ jobs:
2020
name: Building Search Docker Image
2121
runs-on: ubuntu-latest
2222
steps:
23+
- name: Declare some variables
24+
shell: bash
25+
run: |
26+
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
27+
2328
- name: Checkout the repo
2429
uses: actions/checkout@v4
2530

31+
- name: Setup buildx
32+
uses: docker/setup-buildx-action@v3
33+
2634
- name: Login to Docker Hub
2735
uses: docker/login-action@v3
2836
with:
2937
username: ${{ secrets.DOCKER_USERNAME }}
3038
password: ${{ secrets.DOCKER_PASSWORD }}
3139

32-
- name: Declare some variables
33-
shell: bash
34-
run: |
35-
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
3640

3741
- name: Build and push Docker image
3842
uses: docker/build-push-action@v5
3943
with:
40-
cache-from: type=registry,ref=arguflow/search:latest
41-
cache-to: type=inline
44+
cache-from: type=gha
45+
cache-to: type=gha,mode=max
4246
context: search/
4347
file: ./search/Dockerfile
4448
push: true
@@ -49,25 +53,28 @@ jobs:
4953
name: Building Chat Docker Image
5054
runs-on: ubuntu-latest
5155
steps:
56+
- name: Declare some variables
57+
shell: bash
58+
run: |
59+
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
60+
5261
- name: Checkout the repo
5362
uses: actions/checkout@v4
5463

64+
- name: Setup buildx
65+
uses: docker/setup-buildx-action@v3
66+
5567
- name: Login to Docker Hub
5668
uses: docker/login-action@v3
5769
with:
5870
username: ${{ secrets.DOCKER_USERNAME }}
5971
password: ${{ secrets.DOCKER_PASSWORD }}
6072

61-
- name: Declare some variables
62-
shell: bash
63-
run: |
64-
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
65-
6673
- name: Build and push Docker image
6774
uses: docker/build-push-action@v5
6875
with:
69-
cache-from: type=registry,ref=arguflow/chat:latest
70-
cache-to: type=inline
76+
cache-from: type=gha
77+
cache-to: type=gha,mode=max
7178
context: chat/
7279
file: ./chat/Dockerfile
7380
push: true
@@ -78,25 +85,28 @@ jobs:
7885
name: Building Server Docker Image
7986
runs-on: ubuntu-latest
8087
steps:
88+
- name: Declare some variables
89+
shell: bash
90+
run: |
91+
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
92+
8193
- name: Checkout the repo
8294
uses: actions/checkout@v4
8395

96+
- name: Setup buildx
97+
uses: docker/setup-buildx-action@v3
98+
8499
- name: Login to Docker Hub
85100
uses: docker/login-action@v3
86101
with:
87102
username: ${{ secrets.DOCKER_USERNAME }}
88103
password: ${{ secrets.DOCKER_PASSWORD }}
89104

90-
- name: Declare some variables
91-
shell: bash
92-
run: |
93-
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
94-
95105
- name: Build and push Docker image
96106
uses: docker/build-push-action@v5
97107
with:
98-
cache-from: type=registry,ref=arguflow/server:latest
99-
cache-to: type=inline
108+
cache-from: type=gha
109+
cache-to: type=gha,mode=max
100110
context: server/
101111
file: ./server/Dockerfile
102112
push: true

0 commit comments

Comments
 (0)