-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:multiversx/mx-explorer-dapp into de…
…velopment
- Loading branch information
Showing
7 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
attestations: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '18' # Specify your Node.js version | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | ||
with: | ||
images: multiversx/mx-explorer-dapp | ||
|
||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Use the official Node.js image | ||
FROM node:18 AS build | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
# Install dependencies | ||
RUN yarn install | ||
RUN yarn copy-placeholder-config & yarn build | ||
|
||
# Production image | ||
FROM nginx:alpine | ||
|
||
# Copy the build files to the Nginx HTML directory | ||
COPY --from=build /app/build /usr/share/nginx/html | ||
COPY ./entrypoint.sh . | ||
RUN chmod +x entrypoint.sh | ||
|
||
# Expose port 80 | ||
EXPOSE 80 | ||
CMD ["./entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: "3.9" | ||
|
||
services: | ||
test: | ||
ports: | ||
- 127.0.0.1:80:80 | ||
container_name: explorer | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
environment: | ||
START_NAME_STOP: testnet | ||
START_CHAIN_ID_STOP: D | ||
START_EGLD_LABEL_STOP: xEGLD | ||
START_WALLET_ADDRESS_STOP: https://testnet-wallet.multiversx.com | ||
START_EXPLORER_ADDRESS_STOP: https://testnet-explorer.multiversx.com | ||
START_NFT_EXPLORER_ADDRESS_STOP: https://testnet.xspotlight.com | ||
START_API_ADDRESS_STOP: https://testnet-api.multiversx.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
# Replaces envs if defined | ||
if [ -n "$START_NAME_STOP" ]; then | ||
echo "Name defined: ${START_NAME_STOP}, replacing in config" | ||
find /usr/share/nginx/html/ -type f -exec sed -i 's|START_NAME_STOP|'${START_NAME_STOP}'|g' {} + | ||
fi | ||
|
||
if [ -n "$START_CHAIN_ID_STOP" ]; then | ||
echo "Chain ID defined: ${START_CHAIN_ID_STOP}, replacing in config" | ||
find /usr/share/nginx/html/ -type f -exec sed -i 's|START_CHAIN_ID_STOP|'${START_CHAIN_ID_STOP}'|g' {} + | ||
fi | ||
|
||
if [ -n "$START_EGLD_LABEL_STOP" ]; then | ||
echo "egldLabel defined: ${START_EGLD_LABEL_STOP}, replacing in config" | ||
find /usr/share/nginx/html/ -type f -exec sed -i 's|START_EGLD_LABEL_STOP|'${START_EGLD_LABEL_STOP}'|g' {} + | ||
fi | ||
|
||
if [ -n "$START_WALLET_ADDRESS_STOP" ]; then | ||
echo "WalletAdress defined: ${START_WALLET_ADDRESS_STOP}, replacing in config" | ||
find /usr/share/nginx/html/ -type f -exec sed -i 's|START_WALLET_ADDRESS_STOP|'${START_WALLET_ADDRESS_STOP}'|g' {} + | ||
fi | ||
|
||
if [ -n "$START_EXPLORER_ADDRESS_STOP" ]; then | ||
echo "Explorer address defined: ${START_EXPLORER_ADDRESS_STOP}, replacing in config" | ||
find /usr/share/nginx/html/ -type f -exec sed -i 's|START_EXPLORER_ADDRESS_STOP|'${START_EXPLORER_ADDRESS_STOP}'|g' {} + | ||
fi | ||
|
||
if [ -n "$START_NFT_EXPLORER_ADDRESS_STOP" ]; then | ||
echo "NFT Explorer address defined: ${START_NFT_EXPLORER_ADDRESS_STOP}, replacing in config" | ||
find /usr/share/nginx/html/ -type f -exec sed -i 's|START_NFT_EXPLORER_ADDRESS_STOP|'${START_NFT_EXPLORER_ADDRESS_STOP}'|g' {} + | ||
fi | ||
|
||
if [ -n "$START_API_ADDRESS_STOP" ]; then | ||
echo "API address defined: ${START_API_ADDRESS_STOP}, replacing in config" | ||
find /usr/share/nginx/html/ -type f -exec sed -i 's|START_API_ADDRESS_STOP|'${START_API_ADDRESS_STOP}'|g' {} + | ||
fi | ||
|
||
exec nginx -g 'daemon off;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { NetworkType } from 'types/network.types'; | ||
|
||
import { getStorageCustomNetworks } from './helpers'; | ||
import { allApps, schema } from './sharedConfig'; | ||
export * from './sharedConfig'; | ||
|
||
export const hasExtraNetworks = false; | ||
export const links: NetworkUrlType[] = []; | ||
export const networks: NetworkType[] = [ | ||
{ | ||
default: true, | ||
id: 'START_NAME_STOP', | ||
name: 'START_NAME_STOP', | ||
chainId: 'START_CHAIN_ID_STOP', | ||
adapter: 'api', | ||
theme: 'testnet', | ||
egldLabel: 'START_EGLD_LABEL_STOP', | ||
walletAddress: 'START_WALLET_ADDRESS_STOP', | ||
explorerAddress: 'START_EXPLORER_ADDRESS_STOP', | ||
nftExplorerAddress: 'START_NFT_EXPLORER_ADDRESS_STOP', | ||
apiAddress: 'START_API_ADDRESS_STOP' | ||
}, | ||
|
||
// Saved Custom Network Configs | ||
...getStorageCustomNetworks() | ||
]; | ||
|
||
export const multiversxApps = allApps([ | ||
{ | ||
id: 'wallet', | ||
url: 'START_WALLET_ADDRESS_STOP' | ||
}, | ||
{ | ||
id: 'explorer', | ||
url: 'START_EXPLORER_ADDRESS_STOP' | ||
}, | ||
{ | ||
id: 'xexchange', | ||
url: 'https://devnet.xexchange.com' | ||
}, | ||
{ | ||
id: 'xspotlight', | ||
url: 'START_NFT_EXPLORER_ADDRESS_STOP' | ||
} | ||
]); | ||
|
||
networks.forEach((network) => { | ||
schema.validate(network, { strict: true }).catch(({ errors }) => { | ||
console.error(`Config invalid format for ${network.id}`, errors); | ||
}); | ||
}); |