Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 20 additions & 39 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,8 @@ jobs:
done
docker compose logs db
exit 1
- name: setup binstall
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install forc for tests
run: |
cargo binstall --no-confirm --root tests/fixtures/forc-0.65.0 forc@0.65.0
- uses: WarpBuilds/rust-cache@v2
- name: Run tests
uses: actions-rs/cargo@v1
Expand All @@ -111,41 +108,25 @@ jobs:
- cargo-clippy
- cargo-check
- cargo-test
runs-on: warp-ubuntu-latest-x64-2x
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/fuellabs/forc.pub
tags: |
type=ref,event=branch
type=sha,prefix=
type=semver,pattern={{raw}}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to the ghcr.io registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the image to ghcr.io
uses: Warpbuilds/build-push-action@v6
with:
context: .
file: deployment/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
profile-name: "super-fast-builder"
id-token: write
uses: FuelLabs/github-actions/.github/workflows/docker-build-push.yml@master
secrets:
REGISTRY_USERNAME: ${{ github.repository_owner }}
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
with:
auth-mode: registry-login
registry: ghcr.io
build-backend: native
platforms: linux/amd64,linux/arm64
Comment thread
cursor[bot] marked this conversation as resolved.
runs-on-amd64: ubuntu-latest
runs-on-arm64: ubuntu-24.04-arm
dockerfile: deployment/Dockerfile
docker-context: .
image: ghcr.io/fuellabs/forc.pub
tags: |
type=ref,event=branch
type=sha,prefix=
type=semver,pattern={{raw}}
11 changes: 9 additions & 2 deletions deployment/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1: Build
FROM lukemathwalker/cargo-chef:latest-rust-1.85 as chef

Check warning on line 2 in deployment/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image / native-build (linux/amd64, ubuntu-latest)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 2 in deployment/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image / native-build (linux/arm64, ubuntu-24.04-arm)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
WORKDIR /build/
# hadolint ignore=DL3008

Expand All @@ -12,12 +12,12 @@
&& rm -rf /var/lib/apt/lists/*

# Build forc.pub
FROM chef as planner

Check warning on line 15 in deployment/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image / native-build (linux/amd64, ubuntu-latest)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 15 in deployment/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image / native-build (linux/arm64, ubuntu-24.04-arm)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef as builder

Check warning on line 20 in deployment/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image / native-build (linux/amd64, ubuntu-latest)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 20 in deployment/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image / native-build (linux/arm64, ubuntu-24.04-arm)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY --from=planner /build/recipe.json recipe.json
Expand All @@ -29,8 +29,10 @@
RUN cargo build --release

# Stage 2: Run
FROM rust:1.85 as run

Check warning on line 32 in deployment/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image / native-build (linux/amd64, ubuntu-latest)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 32 in deployment/Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish-image / native-build (linux/arm64, ubuntu-24.04-arm)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

ARG TARGETARCH

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends ca-certificates curl jq git libpq5 rsync \
# Clean up
Expand All @@ -47,11 +49,16 @@

# Install the latest 20 versions of forc with cargo-binstall
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
RUN tags=$(curl -s "https://api.github.com/repos/FuelLabs/sway/tags?per_page=20" | grep '"name"' | sed -E 's/.*"name": "v?([^"]+)".*/\1/') && \
RUN case "${TARGETARCH}" in \
amd64) forc_arch=amd64 ;; \
arm64) forc_arch=arm64 ;; \
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
esac && \
tags=$(curl -s "https://api.github.com/repos/FuelLabs/sway/tags?per_page=20" | grep '"name"' | sed -E 's/.*"name": "v?([^"]+)".*/\1/') && \
echo "Tags fetched from the repository:" && \
for tag in $tags; do \
echo "Tag: $tag" && \
cargo binstall --no-confirm --root "forc-$tag" --pkg-url="https://github.com/FuelLabs/sway/releases/download/v$tag/forc-binaries-linux_amd64.tar.gz" --bin-dir="forc-binaries/forc" --pkg-fmt="tgz" forc; \
cargo binstall --no-confirm --root "forc-$tag" --pkg-url="https://github.com/FuelLabs/sway/releases/download/v${tag}/forc-binaries-linux_${forc_arch}.tar.gz" --bin-dir="forc-binaries/forc" --pkg-fmt="tgz" forc; \
done

COPY --from=builder /build/target/release/forc_pub .
Expand Down
Loading