From 81270047c1856490d2d8c35df83733dfc8448817 Mon Sep 17 00:00:00 2001 From: Elias Datler <46360620+fxgst@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:28:46 +0100 Subject: [PATCH] Update release process (#1) Configure the CI pipeline to trigger on tag creation. Tag new Docker images with `:latest` and their version number. --- .github/workflows/ci.yml | 16 ++++++++-------- CODEOWNERS | 2 +- Dockerfile | 18 ++++++++++++------ README.md | 25 +++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07702cc..04f13cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,8 @@ -# name: Create and publish a Docker image -# Configures this workflow to run every time a change is pushed to the branch called `release`. on: - push: - branches: ['release'] + release: + types: [published] # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: @@ -25,7 +23,7 @@ jobs: 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@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -33,16 +31,18 @@ jobs: # 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@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} # 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@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + uses: docker/build-push-action@v5 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + labels: | + ${{ steps.meta.outputs.labels }} + org.opencontainers.image.description=A canister development environment for the Internet Computer (ICP). diff --git a/CODEOWNERS b/CODEOWNERS index 031f534..86b3b15 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -** @dfinity/testing-verification \ No newline at end of file +** @dfinity/testing-verification @dfinity/sdk \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6a80a52..a30ed0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,14 @@ FROM --platform=linux/amd64 rust:1.75-slim-bookworm -RUN apt -yq update -RUN apt -yqq install --no-install-recommends curl ca-certificates libunwind-dev git - ENV NVM_DIR=/root/.nvm ENV NVM_VERSION=v0.39.7 ENV NODE_VERSION=21.5.0 +ENV DFX_VERSION=0.16.0 +ENV POCKET_IC_SERVER_HASH=69e1408347723dbaa7a6cd2faa9b65c42abbe861 +ENV POCKET_IC_PYTHON_VERSION=2.0.2 + +RUN apt -yq update +RUN apt -yqq install --no-install-recommends curl ca-certificates libunwind-dev git python3 python3-pip # Install Node.js using nvm ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin:${PATH}" @@ -17,10 +20,13 @@ RUN . "${NVM_DIR}/nvm.sh" && nvm alias default v${NODE_VERSION} # Install dfx RUN sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)" -# Install wasm32-unknown-unknown target +# Add wasm32-unknown-unknown target RUN rustup target add wasm32-unknown-unknown -# Install PocketIC -RUN curl -sLO https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/pocket-ic.gz +# Install PocketIC Python +RUN pip3 install pocket-ic==${POCKET_IC_PYTHON_VERSION} --break-system-packages + +# Download the PocketIC server +RUN curl -sLO https://download.dfinity.systems/ic/${POCKET_IC_SERVER_HASH}/openssl-static-binaries/x86_64-linux/pocket-ic.gz RUN gzip -d pocket-ic.gz RUN chmod +x pocket-ic diff --git a/README.md b/README.md index 57c561a..a0063af 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,28 @@ # ICP Developer Environment This repo contains a Docker image that is used for setting up a remote, hybrid or local development environments for new developers on the IC. + +## Usage +This container image can be used as a base for creating a dev container environment that targets ICP development. +Take a look at the repositories below to see dev containers in action: +- [ICP Hello World Motoko](https://github.com/dfinity/icp-hello-world-motoko) +- [ICP Hello World Rust](https://github.com/dfinity/icp-hello-world-rust) + +### Packages and Releases +On the right side, you will find new releases and the latest packages. +You can download the Docker image with + +```bash +docker pull ghcr.io/dfinity/icp-dev-env:latest +``` + +or + +```bash +docker pull ghcr.io/dfinity/icp-dev-env: +``` +for a specific version. + +## Creating a new Release +To release a new version, create a new tag with the corresponding version number. +The CI pipeline will automatically build and push the new image to the GitHub Container Registry (ghcr.io).