-
Notifications
You must be signed in to change notification settings - Fork 1
feat: build multi platform docker images #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
1ab870a
feat: build muilti platform docker images
segunjkf 0919a14
wip: test build on ci
segunjkf 58c9cfd
fix: try fixing failing build
segunjkf 8fe5279
fix: docker building path error
segunjkf ff34d3c
wip: test push image
segunjkf 31f5b38
wip: test build multiplatform on all builds
segunjkf 79d2a8f
wip: test build multiplatform on all builds
segunjkf e9d0a93
wip: test push new multi platform docker image
segunjkf d69edcf
wip: fixing error platform specifications
segunjkf c4d9d9c
wip: try build for only one platform
segunjkf a4d762b
wip: try build for only one platform
segunjkf 6ef39b4
wip: try build for only one platform
segunjkf 8114ecc
build for arm64 and amd64
segunjkf 7e17ecd
wip : try clean up builds
segunjkf 623f905
wip : trying freeing up storage
segunjkf fff6135
wip: try the unthinkable
segunjkf 9d3e31f
wip: add clean up method
segunjkf 58f4e5a
nits: push image only on tag or merge to main
segunjkf ec6aca7
nits: test retag
segunjkf a123c90
nits: test retag
segunjkf 492821d
nits: test retag
segunjkf a29d448
nits: test retag for all arch
segunjkf 26e3f5a
nits: test retag for all arch
segunjkf 78da7c0
nits: test retag for all arch
segunjkf 99bfbf9
nits: test retag for all arch
segunjkf 7aedf59
nits: test retag for all arch
segunjkf 326afe2
nits: test retag for all arch
segunjkf d4e6f61
nits: test retag for all arch
segunjkf a3f69aa
nits: dont want docker build on draft to same cost
segunjkf 43391ad
nits: pr review changes
segunjkf a71a4bc
chore: remove old docker build workflow
segunjkf 93a1716
Merge branch 'main' into segun/multiplaform-docker-build
segunjkf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: Telescope Docker | ||
|
|
||
| # Cancel workflow if there is a new change to the branch. | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: | ||
| - "*" | ||
| merge_group: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - 'feature/**' | ||
| - 'v[0-9]+.[0-9]+' | ||
| # This needs to be declared explicitly so that the job is actually | ||
| # run when moved out of draft. | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
|
|
||
| jobs: | ||
| build-and-push-docker-image: | ||
| # This is done to limit the runner cost. | ||
| # if: github.event.pull_request.draft == false | ||
| name: Build images and push to docker hub | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: List cached docker images | ||
| run: docker image ls | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
| with: | ||
| platforms: all | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Docker Meta | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: blockopsnetwork/telescope | ||
| flavor: | | ||
| latest=false | ||
| tags: | | ||
| type=raw,value={{date 'YYYY-MM-DD'}}-{{sha}} | ||
| type=ref,event=tag | ||
| type=edge | ||
|
|
||
| - name: free disk space | ||
| run: | | ||
| make cleanup-action | ||
|
|
||
| - name: Build telescope image and push to DockerHub | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| file: ./cmd/agent/Dockerfile | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} | ||
| # Compile Docker image only for AMD64 for a regular PR to save some CI time. | ||
| platforms: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && 'linux/amd64,linux/arm64' || 'linux/amd64' }} | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Docker Latest tag For Releases | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: 'Tag of the base image to use' | ||
| required: true | ||
| type: string | ||
| new_tag: | ||
| description: 'New tag to use' | ||
| default: 'latest' | ||
| required: true | ||
| type: string | ||
| dry_run: | ||
| description: "Don't push the tag to DockerHub" | ||
| required: true | ||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
| tag-docker-image: | ||
| name: Retag image and push to DockerHub | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
| with: | ||
| platforms: all | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Create builder | ||
| run: docker buildx create --name mybuilder --use | ||
|
|
||
| - name: Inspect builder | ||
| run: docker buildx inspect --bootstrap | ||
|
|
||
| - name: Pull the original image | ||
| run: docker pull blockopsnetwork/telescope:${{ github.event.inputs.tag }} | ||
|
|
||
| - name: Create new multi-arch image with new tag | ||
| run: docker buildx imagetools create --tag blockopsnetwork/telescope:${{ github.event.inputs.new_tag }} blockopsnetwork/telescope:${{ github.event.inputs.tag }} |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #!/usr/bin/env bash | ||
| # A simple bash script for cleaning Github Action runner to free up storage. | ||
|
|
||
| set -eux | ||
|
|
||
| if [ "${GITHUB_ACTIONS}" = "true" ]; then | ||
| df -h | ||
| echo "::group::/usr/local/*" | ||
| du -hsc /usr/local/* | ||
| echo "::endgroup::" | ||
| # ~1GB | ||
| sudo rm -rf \ | ||
| /usr/local/aws-cli \ | ||
| /usr/local/aws-sam-cil \ | ||
| /usr/local/julia* || : | ||
| echo "::group::/usr/local/bin/*" | ||
| du -hsc /usr/local/bin/* | ||
| echo "::endgroup::" | ||
| # ~1GB (From 1.2GB to 214MB) | ||
| sudo rm -rf \ | ||
| /usr/local/bin/aliyun \ | ||
| /usr/local/bin/aws \ | ||
| /usr/local/bin/aws_completer \ | ||
| /usr/local/bin/azcopy \ | ||
| /usr/local/bin/bicep \ | ||
| /usr/local/bin/cmake-gui \ | ||
| /usr/local/bin/cpack \ | ||
| /usr/local/bin/helm \ | ||
| /usr/local/bin/hub \ | ||
| /usr/local/bin/kubectl \ | ||
| /usr/local/bin/minikube \ | ||
| /usr/local/bin/node \ | ||
| /usr/local/bin/packer \ | ||
| /usr/local/bin/pulumi* \ | ||
| /usr/local/bin/sam \ | ||
| /usr/local/bin/stack \ | ||
| /usr/local/bin/terraform || : | ||
| # 142M | ||
| sudo rm -rf /usr/local/bin/oc || : \ | ||
| echo "::group::/usr/local/share/*" | ||
| du -hsc /usr/local/share/* | ||
| echo "::endgroup::" | ||
| # 506MB | ||
| sudo rm -rf /usr/local/share/chromium || : | ||
| # 1.3GB | ||
| sudo rm -rf /usr/local/share/powershell || : | ||
| echo "::group::/usr/local/lib/*" | ||
| du -hsc /usr/local/lib/* | ||
| echo "::endgroup::" | ||
| # 15GB | ||
| sudo rm -rf /usr/local/lib/android || : | ||
| # 341MB | ||
| sudo rm -rf /usr/local/lib/heroku || : | ||
| # 1.2GB | ||
| sudo rm -rf /usr/local/lib/node_modules || : | ||
| echo "::group::/opt/*" | ||
| du -hsc /opt/* | ||
| echo "::endgroup::" | ||
| # 679MB | ||
| sudo rm -rf /opt/az || : | ||
| echo "::group::/opt/microsoft/*" | ||
| du -hsc /opt/microsoft/* | ||
| echo "::endgroup::" | ||
| # 197MB | ||
| sudo rm -rf /opt/microsoft/powershell || : | ||
| echo "::group::/opt/hostedtoolcache/*" | ||
| du -hsc /opt/hostedtoolcache/* | ||
| echo "::endgroup::" | ||
| # 5.3GB | ||
| sudo rm -rf /opt/hostedtoolcache/CodeQL || : | ||
| # 1.4GB | ||
| sudo rm -rf /opt/hostedtoolcache/go || : | ||
| # 489MB | ||
| sudo rm -rf /opt/hostedtoolcache/PyPy || : | ||
| # 376MB | ||
| sudo rm -rf /opt/hostedtoolcache/node || : | ||
| # Remove Web browser packages | ||
| sudo apt purge -y \ | ||
| firefox \ | ||
| google-chrome-stable \ | ||
| microsoft-edge-stable | ||
| # remove docker images | ||
| docker rmi $(docker image ls -aq) || true | ||
| df -h | ||
| fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.