From 1b85065c3d43f8911ae7ae6213f927a1dbb48a04 Mon Sep 17 00:00:00 2001 From: Elias Datler Date: Thu, 17 Oct 2024 15:29:03 +0200 Subject: [PATCH 1/2] Add new slimmer image without PocketIC Bump version --- Dockerfile | 8 ++++---- azle/Dockerfile | 2 +- slim/Dockerfile | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 slim/Dockerfile diff --git a/Dockerfile b/Dockerfile index eef8775..2bace64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ FROM --platform=linux/amd64 rust:1.75-slim-bookworm ENV NVM_DIR=/root/.nvm -ENV NVM_VERSION=v0.39.7 -ENV NODE_VERSION=21.5.0 -ENV DFX_VERSION=0.23.0 -ENV POCKET_IC_SERVER_VERSION=5.0.0 +ENV NVM_VERSION=v0.40.1 +ENV NODE_VERSION=22.10.0 +ENV DFX_VERSION=0.24.0 +ENV POCKET_IC_SERVER_VERSION=6.0.0 ENV POCKET_IC_PYTHON_VERSION=2.1.0 RUN apt -yq update diff --git a/azle/Dockerfile b/azle/Dockerfile index 2b780d9..0e87cbd 100644 --- a/azle/Dockerfile +++ b/azle/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get -yqq install --no-install-recommends curl ca-certificates \ libunwind-dev # Install dfx -RUN DFX_VERSION=0.23.0 DFXVM_INIT_YES=true sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)" +RUN DFX_VERSION=0.24.0 DFXVM_INIT_YES=true sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)" ENV PATH="/root/.local/share/dfx/bin:$PATH" # Dug out from [here](https://github.com/demergent-labs/azle/blob/main/.github/workflows/test.yml#L251) diff --git a/slim/Dockerfile b/slim/Dockerfile new file mode 100644 index 0000000..68e1cb9 --- /dev/null +++ b/slim/Dockerfile @@ -0,0 +1,27 @@ +FROM --platform=linux/amd64 rust:1.75-slim-bookworm + +ENV NVM_DIR=/root/.nvm +ENV NVM_VERSION=v0.40.1 +ENV NODE_VERSION=22.10.0 +ENV DFX_VERSION=0.24.0 + +RUN apt -yq update +RUN apt -yqq install --no-install-recommends curl ca-certificates libunwind-dev git + +# Install Node.js using nvm +ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin:${PATH}" +RUN curl --fail -sSf https://raw.githubusercontent.com/creationix/nvm/${NVM_VERSION}/install.sh | bash +RUN . "${NVM_DIR}/nvm.sh" && nvm install ${NODE_VERSION} +RUN . "${NVM_DIR}/nvm.sh" && nvm use v${NODE_VERSION} +RUN . "${NVM_DIR}/nvm.sh" && nvm alias default v${NODE_VERSION} + +# Install dfx +RUN DFXVM_INIT_YES=true sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)" +ENV PATH="/root/.local/share/dfx/bin:$PATH" +ENV DFX_VERSION= + +# Add wasm32-unknown-unknown target +RUN rustup target add wasm32-unknown-unknown + +# Clean apt +RUN apt-get autoremove && apt-get clean From 9af57521bbdacb34148f4e8534d96b6630e9c9c3 Mon Sep 17 00:00:00 2001 From: Elias Datler Date: Thu, 17 Oct 2024 15:33:26 +0200 Subject: [PATCH 2/2] Add CI --- .github/workflows/ci.yml | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9739077..db01dbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ on: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + IMAGE_NAME_SLIM: ${{ github.repository }}-slim IMAGE_NAME_AZLE: ${{ github.repository }}-azle jobs: @@ -17,7 +18,6 @@ jobs: permissions: contents: read packages: write - # steps: - name: Checkout repository uses: actions/checkout@v4 @@ -45,7 +45,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: | ${{ steps.meta.outputs.labels }} - org.opencontainers.image.description=A canister development environment for the Internet Computer (ICP). + org.opencontainers.image.description=A canister development environment for the Internet Computer (ICP) for Rust and Motoko. build-and-push-image-azle: runs-on: ubuntu-latest @@ -53,7 +53,6 @@ jobs: permissions: contents: read packages: write - # steps: - name: Checkout repository uses: actions/checkout@v4 @@ -82,3 +81,38 @@ jobs: labels: | ${{ steps.meta.outputs.labels }} org.opencontainers.image.description=A canister development environment for the Internet Computer (ICP) using Azle for TypeScript and JavaScript. + + build-and-push-image-slim: + runs-on: ubuntu-latest + # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_SLIM }} + # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. + # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. + # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: slim + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: | + ${{ steps.meta.outputs.labels }} + org.opencontainers.image.description=A slim canister development environment for the Internet Computer (ICP) for Rust and Motoko.