From b49e865471e5c4c193742803124ade4426e4e194 Mon Sep 17 00:00:00 2001 From: Matthew Sevey <15232757+MSevey@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:28:56 -0400 Subject: [PATCH 1/4] feat: dockerfile for contract initialization --- Dockerfile.contract | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Dockerfile.contract diff --git a/Dockerfile.contract b/Dockerfile.contract new file mode 100644 index 0000000..e405f7a --- /dev/null +++ b/Dockerfile.contract @@ -0,0 +1,36 @@ +# Stage 1: Build the contract using Rust +FROM rust:1.64 as builder + +# Install dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + git \ + bash \ + build-essential \ + libssl-dev \ + ca-certificates \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Set up Rust environment and add wasm target +RUN rustup target add wasm32-unknown-unknown + +# Clone the cw-contracts repository +RUN git clone https://github.com/InterWasm/cw-contracts + +# Navigate to the nameservice contract directory +WORKDIR /cw-contracts/contracts/nameservice + +# Compile the contract to wasm +RUN cargo wasm + +# Stage 2: Create a minimal runtime image +FROM alpine:3.20 + +# Install only the necessary runtime dependencies +RUN apk add --no-cache bash curl ranger vim + +# Copy the nameservice directory from the builder stage +COPY --from=builder /cw-contracts/contracts/nameservice /root/cw-contracts/contracts/nameservice + +# Keep the container running +CMD tail -F /dev/null From a6c033e66c541c0379bd1d0529e71d5f5fb05c41 Mon Sep 17 00:00:00 2001 From: Matthew Sevey <15232757+MSevey@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:51:28 -0400 Subject: [PATCH 2/4] chore(ci): enable contract docker file ci --- .github/workflows/docker-build-publish.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/docker-build-publish.yml b/.github/workflows/docker-build-publish.yml index 2aa7afe..3cfeebe 100644 --- a/.github/workflows/docker-build-publish.yml +++ b/.github/workflows/docker-build-publish.yml @@ -18,3 +18,12 @@ jobs: with: dockerfile: Dockerfile secrets: inherit + + docker-build-contract: + permissions: + contents: write + packages: write + uses: rollkit/.github/.github/workflows/reusable_dockerfile_pipeline.yml@v0.4.1 + with: + dockerfile: Dockerfile.contract + secrets: inherit From cdb40aeebb932eae6e0554c73aca3c723cafb68d Mon Sep 17 00:00:00 2001 From: Matthew Sevey <15232757+MSevey@users.noreply.github.com> Date: Thu, 11 Jul 2024 15:54:54 -0400 Subject: [PATCH 3/4] chore(ci): update inputs for dockerfile workflow --- .github/workflows/docker-build-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-build-publish.yml b/.github/workflows/docker-build-publish.yml index 3cfeebe..a9ef569 100644 --- a/.github/workflows/docker-build-publish.yml +++ b/.github/workflows/docker-build-publish.yml @@ -26,4 +26,5 @@ jobs: uses: rollkit/.github/.github/workflows/reusable_dockerfile_pipeline.yml@v0.4.1 with: dockerfile: Dockerfile.contract + packageName: contract secrets: inherit From 15d2db921c65b455d741156a129320ec7b0496cd Mon Sep 17 00:00:00 2001 From: Matthew Sevey <15232757+MSevey@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:01:07 -0400 Subject: [PATCH 4/4] chore: update rust version and lock in cw-contract version --- Dockerfile.contract | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile.contract b/Dockerfile.contract index e405f7a..7565743 100644 --- a/Dockerfile.contract +++ b/Dockerfile.contract @@ -1,5 +1,5 @@ # Stage 1: Build the contract using Rust -FROM rust:1.64 as builder +FROM rust:1.79 as builder # Install dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -15,7 +15,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN rustup target add wasm32-unknown-unknown # Clone the cw-contracts repository -RUN git clone https://github.com/InterWasm/cw-contracts +RUN git clone https://github.com/InterWasm/cw-contracts && \ + cd cw-contracts && \ + git checkout v0.11.0 # Navigate to the nameservice contract directory WORKDIR /cw-contracts/contracts/nameservice