Skip to content

Commit

Permalink
Merge pull request #379 from leovct/fix/zkevm-bridge-img-revert
Browse files Browse the repository at this point in the history
revert: zkevm-bridge-ui image changes
  • Loading branch information
praetoriansentry authored Nov 14, 2024
2 parents 30403f7 + 11578b1 commit 60f6e4c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
1 change: 0 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Kurtosis CDK's zkevm bridge UI images are [hosted](https://hub.docker.com/reposi

| zkEVM Bridge UI Tag / Commit | Image |
| ---------------------------- | ----- |
| [develop@0006445](https://github.com/0xPolygonHermez/zkevm-bridge-ui/commit/0006445e1cace5c4d737523fca44af7f7261e041) + [patch files](./zkevm-bridge-ui/) | `leovct/zkevm-bridge-ui:multi-network-2` |
| [develop@0006445](https://github.com/0xPolygonHermez/zkevm-bridge-ui/commit/0006445e1cace5c4d737523fca44af7f7261e041) | `leovct/zkevm-bridge-ui:multi-network` |

## Custom Docker Images
Expand Down
23 changes: 2 additions & 21 deletions docker/zkevm-bridge-ui/deploy.sh.diff
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
index 22e5b09..b751cbd 100644
index 22e5b09..00da634 100644
--- a/scripts/deploy.sh
+++ b/scripts/deploy.sh
@@ -21,6 +21,9 @@ echo "VITE_POLYGON_ZK_EVM_NETWORK_ID=$POLYGON_ZK_EVM_NETWORK_ID" >> $ENV_FILENAM
# BRIDGE API env vars
echo "VITE_BRIDGE_API_URL=$BRIDGE_API_URL" >> $ENV_FILENAME

+# Support for relative URLS
+echo "VITE_RESOLVE_RELATIVE_URLS=$RESOLVE_RELATIVE_URLS" >> $ENV_FILENAME
+
# FIAT EXCHANGE RATES API env vars
echo "VITE_ENABLE_FIAT_EXCHANGE_RATES=$ENABLE_FIAT_EXCHANGE_RATES" >> $ENV_FILENAME

@@ -91,17 +94,5 @@ fi
echo "Generated .env file:"
echo "$(cat /app/.env)"

-# Build app
-cd /app && npm run build
-
-# Copy nginx config
-cp /app/deployment/nginx.conf /etc/nginx/conf.d/default.conf
-
-# Copy app dist
-cp -r /app/dist/. /usr/share/nginx/html
-
-# Delete source code
-rm -rf /app
-
# Run nginx
nginx -g 'daemon off;'
23 changes: 14 additions & 9 deletions docker/zkevm-bridge-ui/zkevm-bridge-ui.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
FROM alpine:3.20 AS builder

# STEP 1: Clone zkevm-bridge-ui repository.
ARG ZKEVM_BRIDGE_UI_TAG
WORKDIR /opt/zkevm-bridge-ui
# WARNING (DL3018): Pin versions in apk add.
# hadolint ignore=DL3018
RUN apk add --no-cache git nodejs npm patch \
RUN apk add --no-cache git patch \
&& rm -rf /var/cache/apk/* \
&& git clone --branch ${ZKEVM_BRIDGE_UI_TAG} https://github.com/0xPolygonHermez/zkevm-bridge-ui .

# STEP 2: Apply patches and build the app.
# STEP 2: Apply patches.
COPY deploy.sh.diff env.ts.diff ./
RUN patch -p1 -i deploy.sh.diff \
&& patch -p1 -i env.ts.diff \
&& npm install \
&& npm run build
&& patch -p1 -i env.ts.diff


# STEP 3: Serve the app using nginx.
# STEP 3: Build zkevm-bridge-ui image using the official Dockerfile.
FROM nginx:alpine
LABEL author="[email protected]"
LABEL description="Enhanced zkevm-bridge-ui image with relative URLs support enabled"

COPY --from=builder /opt/zkevm-bridge-ui/dist /usr/share/nginx/html
COPY --from=builder /opt/zkevm-bridge-ui/deployment/nginx.conf /etc/nginx/conf.d/default.conf
# WARNING (DL3018): Pin versions in apk add.
# hadolint ignore=DL3018
RUN apk add --no-cache nodejs npm \
&& rm -rf /var/cache/apk/*

WORKDIR /app
COPY --from=builder /opt/zkevm-bridge-ui/package.json /opt/zkevm-bridge-ui/package-lock.json ./
COPY --from=builder /opt/zkevm-bridge-ui/scripts ./scripts
COPY --from=builder /opt/zkevm-bridge-ui/abis ./abis
RUN npm install
COPY --from=builder /opt/zkevm-bridge-ui/ .

WORKDIR /
ENTRYPOINT ["/bin/sh", "/app/scripts/deploy.sh"]

0 comments on commit 60f6e4c

Please sign in to comment.