diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7af2639904..022c4acdc7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -217,10 +217,39 @@ jobs: const prunePrereleases = require('./.github/scripts/prune-prereleases.js') await prunePrereleases({github, context}) - docker-build-and-push: - name: Build and push Docker image + docker-build-and-push-linux-arm64: + name: Build and push linux-arm64 docker image runs-on: ubuntu-latest-4-cores - needs: prepare + needs: [prepare, release] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push docker image + uses: docker/build-push-action@v4 + with: + push: true + tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ needs.prepare.outputs.tag_name }} + platforms: linux/arm64 + target: arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + + docker-build-and-push-linux-amd64: + name: Build and push linux-amd64 docker image + runs-on: ubuntu-latest-4-cores + needs: [prepare, release] steps: - name: Checkout repository @@ -236,9 +265,12 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image + - name: Build and push docker image uses: docker/build-push-action@v4 with: push: true tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ needs.prepare.outputs.tag_name }} - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 + target: amd64 + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index b2a0054d70..685091562d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,16 @@ -FROM rust:slim-buster as builder -RUN apt-get -y update; \ - apt-get install -y --no-install-recommends \ - curl libssl-dev make clang-11 g++ llvm protobuf-compiler \ - pkg-config libz-dev zstd git; \ - apt-get autoremove -y; \ - apt-get clean; \ - rm -rf /var/lib/apt/lists/* +FROM debian:buster-slim as base -WORKDIR /dojo -COPY . . -RUN cargo build --release --config net.git-fetch-with-cli=true - -FROM debian:buster-slim LABEL description="Dojo is a provable game engine and toolchain for building onchain games and autonomous worlds with Cairo" \ authors="tarrence " \ source="https://github.com/dojoengine/dojo" \ documentation="https://book.dojoengine.org/" -RUN apt-get -y update; \ - apt-get install -y --no-install-recommends \ - curl; \ - apt-get autoremove -y; \ - apt-get clean; \ - rm -rf /var/lib/apt/lists/* - -# Set an environment variable for the port -ENV HEALTH_CHECK_PORT=5050 - -HEALTHCHECK --interval=3s --timeout=5s --start-period=1s --retries=5 \ - CMD curl --request POST \ - --header "Content-Type: application/json" \ - --data '{"jsonrpc": "2.0","method": "starknet_chainId","id":1}' http://localhost:${HEALTH_CHECK_PORT} || exit 1 +FROM base as amd64 +COPY target/x86_64-unknown-linux-gnu/release/katana /usr/local/bin/katana +COPY target/x86_64-unknown-linux-gnu/release/sozo /usr/local/bin/sozo +COPY target/x86_64-unknown-linux-gnu/release/torii /usr/local/bin/torii -COPY --from=builder /dojo/target/release/katana /usr/local/bin/katana -COPY --from=builder /dojo/target/release/sozo /usr/local/bin/sozo -COPY --from=builder /dojo/target/release/torii /usr/local/bin/torii +FROM base as arm64 +COPY target/aarch64-unknown-linux-gnu/release/katana /usr/local/bin/katana +COPY target/aarch64-unknown-linux-gnu/release/sozo /usr/local/bin/sozo +COPY target/aarch64-unknown-linux-gnu/release/torii /usr/local/bin/torii