diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9fe342c --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +./target diff --git a/Cargo.lock b/Cargo.lock index 2056791..ba112b5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1030,7 +1030,7 @@ dependencies = [ [[package]] name = "cargo-stylus" -version = "0.5.5" +version = "0.5.6" dependencies = [ "alloy-contract", "alloy-ethers-typecast", @@ -1072,7 +1072,7 @@ dependencies = [ [[package]] name = "cargo-stylus-example" -version = "0.5.5" +version = "0.5.6" dependencies = [ "clap", ] diff --git a/Cargo.toml b/Cargo.toml index 37ce93a..f838050 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ resolver = "2" [workspace.package] authors = ["Offchain Labs"] -version = "0.5.5" +version = "0.5.6" edition = "2021" homepage = "https://arbitrum.io" license = "MIT OR Apache-2.0" diff --git a/Dockerfile b/Dockerfile index 48fe819..a3a8515 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,15 @@ -FROM --platform=linux/amd64 rust:1.80 as builder +ARG BUILD_PLATFORM=linux/amd64 +ARG RUST_VERSION=1.80 +ARG CARGO_STYLUS_VERSION + +FROM --platform=${BUILD_PLATFORM} rust:${RUST_VERSION} AS builder RUN apt-get update && apt-get install -y git RUN rustup target add x86_64-unknown-linux-gnu -RUN git clone https://github.com/offchainlabs/cargo-stylus.git +ARG CARGO_STYLUS_VERSION +RUN test -n "$CARGO_STYLUS_VERSION" +RUN git clone --branch v$CARGO_STYLUS_VERSION https://github.com/offchainlabs/cargo-stylus.git WORKDIR /cargo-stylus -RUN git checkout v0.5.2 RUN cargo build --release --manifest-path main/Cargo.toml -FROM --platform=linux/amd64 rust:1.80 -COPY --from=builder /cargo-stylus/target/release/cargo-stylus /usr/local/bin/cargo-stylus \ No newline at end of file + +FROM --platform=${BUILD_PLATFORM} rust:${RUST_VERSION} AS cargo-stylus-base +COPY --from=builder /cargo-stylus/target/release/cargo-stylus /usr/local/bin/cargo-stylus diff --git a/Makefile b/Makefile index c63a85a..b4fbed4 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +CARGO_STYLUS_VERSION := $(shell cargo pkgid --manifest-path main/Cargo.toml | cut -d '@' -f 2) + .PHONY: build build: cargo build @@ -17,3 +19,7 @@ lint: .PHONY: install install: fmt lint cargo install --path main + +.PHONY: docker +docker: + docker build -t cargo-stylus-base:$(CARGO_STYLUS_VERSION) --build-arg CARGO_STYLUS_VERSION=$(CARGO_STYLUS_VERSION) .