Skip to content

Commit 103a83c

Browse files
committed
chore: update Dockerfile to use asdf and not dojoup
1 parent 025461f commit 103a83c

3 files changed

Lines changed: 42 additions & 7 deletions

File tree

.github/workflows/docker.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This workflow is triggered by a workflow_dispatch event or when a new release with a tag starting with `v` is published.
44
#
5-
# The docker image is built by using `dojoup` to bundle the Dojo binaries with the docker image, there is no heavy compilation
5+
# The docker image is built by using `asdf` to bundle the Dojo binaries with the docker image, there is no heavy compilation
66
# of the Dojo binaries during this workflow.
77
#
88
# The docker image is pushed to the GitHub Container Registry: https://github.com/dojoengine/dojo/pkgs/container/dojo
@@ -58,13 +58,15 @@ jobs:
5858
fi
5959
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
6060
61-
# Dojoup doesn't require the prefix v and automatically adds it.
6261
echo "dojo_version=${{ inputs.dojo_version }}" >> $GITHUB_OUTPUT
6362
fi
6463
6564
docker-build-and-push:
6665
runs-on: ubuntu-latest-32-cores
6766
needs: prepare
67+
strategy:
68+
matrix:
69+
platform: [linux/amd64, linux/arm64]
6870

6971
steps:
7072
- name: Checkout repository
@@ -85,6 +87,6 @@ jobs:
8587
with:
8688
push: true
8789
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ needs.prepare.outputs.tag_name }}
88-
platforms: linux/amd64,linux/arm64
90+
platforms: ${{ matrix.platform }}
8991
build-args: |
9092
DOJO_VERSION=${{ needs.prepare.outputs.dojo_version }}

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ scarb 2.12.2
22
starknet-foundry 0.48.1
33
cairo-profiler 0.9.0
44
katana 1.7.0-alpha.3
5+
torii 1.7.3

Dockerfile

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,54 @@ RUN git clone https://github.com/Comcast/Infinite-File-Curtailer.git curtailer \
1717
FROM ubuntu:24.04 AS base
1818

1919
RUN apt-get update && \
20-
apt-get install -y curl ca-certificates libssl-dev tini jq git && \
20+
apt-get install -y curl wget ca-certificates libssl-dev tini jq git && \
2121
apt-get clean && \
2222
rm -rf /var/lib/apt/lists/* && \
2323
cp /usr/bin/tini /tini
2424

2525
ENTRYPOINT ["/tini", "--"]
2626

2727
ARG DOJO_VERSION
28+
ARG TARGETARCH
2829

2930
LABEL description="Dojo is a provable game engine and toolchain for building onchain games and autonomous worlds with Cairo" \
3031
authors="tarrence <tarrence@cartridge.gg>" \
3132
source="https://github.com/dojoengine/dojo" \
3233
documentation="https://book.dojoengine.org/"
3334

34-
COPY ./dojoup ./dojoup
35-
RUN bash ./dojoup/install
36-
RUN . ~/.dojo/env && dojoup install $DOJO_VERSION
35+
# Define the ASDF related variables.
36+
# Note that the data dir is also invovled.
37+
ENV ASDF_VERSION=v0.18.0
38+
ENV ASDF_DIR=/opt/asdf
39+
ENV ASDF_BIN_DIR=${ASDF_DIR}/bin
40+
ENV ASDF_DATA_DIR=${ASDF_DIR}/
41+
42+
# Add to the PATH + ensure the ASDF_DATA_DIR is also set,
43+
# to have next invocation of asdf working as expected.
44+
ENV PATH="${ASDF_BIN_DIR}:${ASDF_DATA_DIR}/shims:$PATH"
45+
ENV ASDF_DATA_DIR=${ASDF_DATA_DIR}
46+
47+
# Install ASDF from pre-built binaries github release (easiest way IMHO).
48+
RUN wget -q https://github.com/asdf-vm/asdf/releases/download/${ASDF_VERSION}/asdf-${ASDF_VERSION}-linux-${TARGETARCH}.tar.gz -O /tmp/asdf.tar.gz && \
49+
mkdir -p $ASDF_BIN_DIR && \
50+
tar -xzf /tmp/asdf.tar.gz -C $ASDF_BIN_DIR && \
51+
rm /tmp/asdf.tar.gz && \
52+
ls -laR ${ASDF_DIR}
53+
54+
RUN chmod +x $ASDF_BIN_DIR/asdf && ls -alR $ASDF_DIR/
55+
RUN asdf --version
56+
57+
COPY .tool-versions /root/.tool-versions
58+
# Add sozo and torii to the tool-versions file for all in one.
59+
RUN echo "sozo ${DOJO_VERSION}" >> /root/.tool-versions
60+
RUN echo "torii ${DOJO_VERSION}" >> /root/.tool-versions
61+
62+
RUN asdf plugin add scarb https://github.com/software-mansion/asdf-scarb.git && \
63+
asdf plugin add starknet-foundry https://github.com/foundry-rs/asdf-starknet-foundry && \
64+
asdf plugin add katana https://github.com/dojoengine/asdf-katana.git && \
65+
asdf plugin add sozo https://github.com/dojoengine/asdf-sozo.git && \
66+
asdf plugin add torii https://github.com/dojoengine/asdf-torii.git && \
67+
asdf install && \
68+
asdf reshim
3769

3870
COPY --from=builder /usr/local/bin/curtail /usr/local/bin/curtail

0 commit comments

Comments
 (0)