Skip to content

Commit

Permalink
feat: publish a new docker image for arch deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
viraj124 committed Oct 23, 2024
1 parent e29e1e6 commit dd2945c
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ jobs:
tags: ghcr.io/fuellabs/fuel-bridge-full:latest
file: docker/full-env/Dockerfile
platforms: linux/amd64,linux/arm64
- name: Build and push multi-arch fuel-bridge-full arm image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ghcr.io/fuellabs/fuel-bridge-full:arm
file: docker/arm/Dockerfile
platforms: linux/amd64,linux/arm64
78 changes: 78 additions & 0 deletions docker/arm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This image is built for external projects that want to have
# an e2e test environment
FROM ghcr.io/fuellabs/fuel-core:v0.36.0 as fuel-core
FROM ghcr.io/fuellabs/fuel-block-committer:v0.4.0 as fuel-committer

FROM node:20-slim as base
USER 0
ENV DEBIAN_FRONTEND=noninteractive
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

RUN apt update
RUN apt install -y curl git file jq

# Download and install forc binaries
FROM base as forc-downloader

COPY fuel-toolchain.toml .

RUN ARCH=$(uname -m) && \
FORC_VERSION=$(awk -F'"' '/forc = / {print $2}' fuel-toolchain.toml) && \
if [ "$ARCH" = "aarch64" ]; then \
FORC_URL="https://github.com/FuelLabs/sway/releases/download/v$FORC_VERSION/forc-binaries-linux_arm64.tar.gz"; \
elif [ "$ARCH" = "x86_64" ]; then \
FORC_URL="https://github.com/FuelLabs/sway/releases/download/v$FORC_VERSION/forc-binaries-linux_amd64.tar.gz"; \
else \
echo "Unsupported architecture: $ARCH" && exit 1; \
fi && \
mkdir -p /tmp/forc-binaries && \
curl -L $FORC_URL | tar -xz -C /tmp && \
mv /tmp/forc-binaries/* /usr/local/bin/

# Download and install anvil
FROM base as foundry-downloader
RUN curl -L https://foundry.paradigm.xyz | bash
RUN /root/.foundry/bin/foundryup

FROM base as base-builder

COPY --from=fuel-core /root/fuel-core /root/fuel-core
COPY --from=fuel-committer /root/fuel-block-committer /root/fuel-block-committer
COPY --from=forc-downloader /usr/local/bin/forc* /usr/local/bin
COPY --from=foundry-downloader /root/.foundry /root/.foundry

ENV DEBIAN_FRONTEND=noninteractive
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm i -g pm2

WORKDIR /fuel-bridge

COPY packages packages
COPY package.json package.json
COPY pnpm-* .
COPY Forc* .
COPY fuel-toolchain.toml .
COPY tsconfig.json .
COPY turbo.json .

RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

FROM base-builder as sway-contracts
RUN cd /fuel-bridge/packages/esbuild-bin-loader && pnpm build
RUN cd /fuel-bridge && forc build --release
RUN cd /fuel-bridge/packages/fungible-token && pnpm build

FROM base-builder as solidity-contracts
RUN cd /fuel-bridge/packages/solidity-contracts && pnpm build

FROM solidity-contracts as arm

COPY --from=sway-contracts /fuel-bridge/packages/esbuild-bin-loader /fuel-bridge/packages/esbuild-bin-loader
COPY --from=sway-contracts /fuel-bridge/packages/fungible-token /fuel-bridge/packages/fungible-token

COPY docker/arm/run.sh /run.sh

ENTRYPOINT [ "bash", "/run.sh" ]

0 comments on commit dd2945c

Please sign in to comment.