Skip to content
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

Build the Docker image for arm64 as well #1548

Draft
wants to merge 47 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0e8e493
Build the Docker image for `arm64` as well
tomaka Jan 3, 2024
2f9d154
Work in progress
tomaka Jan 3, 2024
44753ba
Fix target
tomaka Jan 3, 2024
bea5cac
Don't set the build platform
tomaka Jan 3, 2024
bae9250
Import docker images
tomaka Jan 3, 2024
305b1bd
Fix ARG going out of scope
tomaka Jan 3, 2024
fd7bf5c
Don't use ARG in the second stage, actually
tomaka Jan 3, 2024
73e3540
Try to make it work
tomaka Jan 3, 2024
cd3d2c8
Why the hell does a typo trigger only a warning and not an error
tomaka Jan 3, 2024
17b8a5d
Forbidden characters in artifact name
tomaka Jan 3, 2024
585dbf8
Try compiling for -gnu
tomaka Jan 3, 2024
9f5eec3
Try compile for arm64 on an arm64 machine
tomaka Jan 3, 2024
86b5086
Remove unnecessary permission
tomaka Jan 3, 2024
3213663
Try use just macos-latest to see if it works
tomaka Jan 3, 2024
f1d4692
Add TODO
tomaka Jan 3, 2024
c561a07
Change command to import images
tomaka Jan 3, 2024
a67f10b
Revert to ubuntu-latest
tomaka Jan 3, 2024
19d2de4
Fix missing permission
tomaka Jan 3, 2024
5b8723b
Tweaks
tomaka Jan 3, 2024
c64a99f
Wasted an hour of CPU for a typo
tomaka Jan 4, 2024
3c1ae5d
Line-separated images list
tomaka Jan 4, 2024
664ac2d
Adds tags to the relevant images
tomaka Jan 4, 2024
5dd8c5b
Some tweaks that won't work
tomaka Jan 4, 2024
3f65b04
Change approach
tomaka Jan 4, 2024
5df1bd8
Another typo
tomaka Jan 4, 2024
1422160
Not sure what to do anymore
tomaka Jan 4, 2024
ffa51ec
Let's try that
tomaka Jan 4, 2024
3f2883a
Let's try with manual tags
tomaka Jan 4, 2024
0e09981
Try `docker manifest`
tomaka Jan 5, 2024
6e69dac
Typo
tomaka Jan 5, 2024
9e30178
Let's try only amd64
tomaka Jan 18, 2024
bfa2fde
Add manifest inspect commands to debug
tomaka Jan 18, 2024
86e63ec
Try passing by hash
tomaka Jan 18, 2024
e12aa52
Add space, not sure if needed
tomaka Jan 18, 2024
373552c
Try remove new lines just to make sure
tomaka Jan 18, 2024
325efde
Merge branch 'main' into docker-arm64
tomaka Jan 31, 2024
78a945c
Use the new Mac runners
tomaka Jan 31, 2024
66c8058
Install docker
tomaka Jan 31, 2024
c2e25e7
Try also docker-machine
tomaka Jan 31, 2024
4ae181d
Following instructions
tomaka Jan 31, 2024
deeabf8
Revert and abandon for now
tomaka Jan 31, 2024
2281739
Try again something
tomaka Jan 31, 2024
3400e98
Try more things
tomaka Jan 31, 2024
ab88cfe
Try something else
tomaka Jan 31, 2024
6e4d571
Again, try something else
tomaka Jan 31, 2024
0a7d798
Try issue fix
tomaka Jan 31, 2024
8a1585b
Try again differently
tomaka Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 49 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,67 @@ on:
permissions: read-all

jobs:
build-push-docker-image:
build-docker-image:
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'macos-14' }}
permissions:
contents: read
steps:
- run: |
brew install docker
colima start
if: runner.os == 'macos'
- uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
with:
path: repo
- uses: docker/[email protected]
with:
context: ./repo
platforms: ${{ matrix.platform }}
build-args: |
TARGET=${{ matrix.platform == 'linux/amd64' && 'x86_64-unknown-linux-gnu' || 'aarch64-unknown-linux-gnu' }}
file: ./repo/full-node/Dockerfile
tags: ghcr.io/smol-dot/full-node:${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
outputs: type=docker,dest=./image.tar
- uses: actions/upload-artifact@v4
with:
name: docker-image-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
path: ./image.tar
if-no-files-found: error
retention-days: 1

push-docker-image:
runs-on: ubuntu-latest
needs:
build-docker-image
permissions:
contents: read
packages: write
steps:
- uses: docker/setup-qemu-action@v3
- uses: actions/download-artifact@v4
with:
path: .
- uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
- run: |
ls -1 */*.tar | xargs --no-run-if-empty -L 1 docker load --input
- uses: docker/login-action@v3
# This `if` adds an additional safety against accidental pushes.
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/[email protected]
with:
context: .
file: ./full-node/Dockerfile
load: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: ghcr.io/smol-dot/full-node:main
- run: docker push ghcr.io/smol-dot/full-node:main
- run: docker images # TODO remove
- run: docker images --no-trunc -q ghcr.io/smol-dot/full-node | sed 's/.*/ --amend &/' | tr -d '\n' # TODO: remove
- run: |
docker manifest create \
ghcr.io/smol-dot/full-node:main \
$(docker images --no-trunc -q ghcr.io/smol-dot/full-node | sed 's/.*/ --amend &/' | tr -d '\n')
- run: docker images # TODO remove
- run: docker manifest push ghcr.io/smol-dot/full-node:main
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

build-js-doc:
Expand Down Expand Up @@ -271,7 +309,7 @@ jobs:
all-deploy:
# This dummy job depends on all the mandatory checks. It succeeds if and only if CI is
# considered successful.
needs: [build-push-docker-image, docs-publish, npm-publish, deno-publish, crates-io-publish]
needs: [push-docker-image, docs-publish, npm-publish, deno-publish, crates-io-publish]
runs-on: ubuntu-latest
steps:
- run: echo Success
11 changes: 7 additions & 4 deletions full-node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM rust:1 AS builder
LABEL maintainer "Pierre Krieger <[email protected]>"

ARG TARGET

COPY ./.. /build
WORKDIR /build

RUN apt-get update && apt-get install -y musl-tools
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo build --target x86_64-unknown-linux-musl --package smoldot-full-node --release --verbose
RUN rustup target add $TARGET
RUN cargo build --target $TARGET --package smoldot-full-node --release --verbose
RUN mv ./target/$TARGET/release/full-node ./full-node


FROM alpine:latest
LABEL maintainer "Pierre Krieger <[email protected]>"
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/full-node /usr/local/bin

COPY --from=builder /build/full-node /usr/local/bin

EXPOSE 30333
ENTRYPOINT ["/usr/local/bin/full-node"]
Loading