-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: split agent & controller image && reduce image size
Signed-off-by: bingshen.wbs <[email protected]>
- Loading branch information
Showing
8 changed files
with
66 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,18 +29,21 @@ jobs: | |
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
- name: Docker meta agent | ||
id: meta-agent | ||
uses: docker/metadata-action@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Docker meta | ||
id: meta | ||
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/agent | ||
tags: | | ||
type=raw,value={{date 'YYYYMMDD'}}-{{sha}} | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{raw}} | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
- name: Docker meta controller | ||
id: meta-controller | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/kubeskoop | ||
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/controller | ||
tags: | | ||
type=raw,value={{date 'YYYYMMDD'}}-{{sha}} | ||
type=semver,pattern={{version}} | ||
|
@@ -54,12 +57,39 @@ jobs: | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
if: ${{ github.event_name != 'pull_request' && github.event.action != 'unassigned' }} | ||
|
||
- name: Build and push | ||
- name: Go Build Cache for Docker | ||
uses: actions/cache@v3 | ||
with: | ||
path: go-build-cache | ||
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} | ||
- name: inject go-build-cache into docker | ||
# v1 was composed of two actions: "inject" and "extract". | ||
# v2 is unified to a single action. | ||
uses: reproducible-containers/[email protected] | ||
with: | ||
cache-source: go-build-cache | ||
|
||
- name: Build and push agent | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta-agent.outputs.tags }} | ||
target: agent | ||
labels: ${{ steps.meta-agent.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
- name: Build and push controller | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
tags: ${{ steps.meta-controller.outputs.tags }} | ||
target: controller | ||
labels: ${{ steps.meta-controller.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2046,7 +2046,7 @@ | |
"mode": "absolute", | ||
"steps": [ | ||
{ | ||
"color": "green", | ||
"color": "green" | ||
}, | ||
{ | ||
"color": "red", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters