Skip to content

Commit 7bedb45

Browse files
committed
move forc installation to final image
1 parent 3edbfd4 commit 7bedb45

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

deployment/Dockerfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ RUN cargo chef prepare --recipe-path recipe.json
1919

2020
FROM chef as builder
2121

22-
# Install the latest 20 versions of forc with cargo-binstall
23-
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
24-
RUN tags=$(curl -s "https://api.github.com/repos/FuelLabs/sway/tags?per_page=20" | grep '"name"' | sed -E 's/.*"name": "v?([^"]+)".*/\1/') && \
25-
echo "Tags fetched from the repository:" && \
26-
for tag in $tags; do \
27-
echo "Tag: $tag" && \
28-
cargo binstall --no-confirm --root "/usr/local/cargo/bin/forc-$tag" --pkg-url="https://github.com/FuelLabs/sway/releases/download/v$tag/forc-binaries-linux_arm64.tar.gz" --bin-dir="forc-binaries/forc" --pkg-fmt="tgz" forc; \
29-
done
30-
3122
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
3223
COPY --from=planner /build/recipe.json recipe.json
3324
# Build our project dependecies, not our application!
@@ -47,11 +38,17 @@ RUN apt-get update -y \
4738
&& apt-get clean -y \
4839
&& rm -rf /var/lib/apt/lists/*
4940

41+
# Install the latest 20 versions of forc with cargo-binstall
5042
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
43+
RUN tags=$(curl -s "https://api.github.com/repos/FuelLabs/sway/tags?per_page=20" | grep '"name"' | sed -E 's/.*"name": "v?([^"]+)".*/\1/') && \
44+
echo "Tags fetched from the repository:" && \
45+
for tag in $tags; do \
46+
echo "Tag: $tag" && \
47+
cargo binstall --no-confirm --root "forc-$tag" --pkg-url="https://github.com/FuelLabs/sway/releases/download/v$tag/forc-binaries-linux_arm64.tar.gz" --bin-dir="forc-binaries/forc" --pkg-fmt="tgz" forc; \
48+
done
5149

5250
WORKDIR /root/
5351

54-
COPY --from=builder /usr/local/cargo/bin/forc-* .
5552
COPY --from=builder /build/target/debug/forc_pub .
5653
COPY --from=builder /build/target/debug/forc_pub.d .
5754
COPY --from=builder /build/Rocket.toml .

0 commit comments

Comments
 (0)