ALM docker improvements (#380)

This commit is contained in:
Gerardo Nardelli 2020-07-01 18:34:27 -03:00 committed by GitHub
parent ab814f831c
commit dc27bd6caa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 8 deletions

@ -11,4 +11,5 @@ ALM_HOME_EXPLORER_TX_TEMPLATE=https://blockscout.com/poa/sokol/tx/%s
ALM_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s ALM_FOREIGN_EXPLORER_TX_TEMPLATE=https://blockscout.com/eth/kovan/tx/%s
ALM_HOME_EXPLORER_API=https://blockscout.com/poa/sokol/api ALM_HOME_EXPLORER_API=https://blockscout.com/poa/sokol/api
ALM_FOREIGN_EXPLORER_API=https://kovan.etherscan.io/api ALM_FOREIGN_EXPLORER_API=https://kovan.etherscan.io/api?apikey=YourApiKeyToken
PORT=8080

@ -1,4 +1,4 @@
FROM node:12 FROM node:12 as alm-builder
WORKDIR /mono WORKDIR /mono
COPY package.json . COPY package.json .
@ -19,5 +19,11 @@ ARG DOT_ENV_PATH=./alm/.env
COPY ${DOT_ENV_PATH} ./alm/.env COPY ${DOT_ENV_PATH} ./alm/.env
WORKDIR /mono/alm WORKDIR /mono/alm
CMD echo "To start the application run:" \ RUN yarn run build
"yarn start"
FROM node:12 as alm-production
RUN yarn global add serve
WORKDIR /app
COPY --from=alm-builder /mono/alm/build .
CMD serve -p $PORT -s .

@ -5,8 +5,10 @@ services:
build: build:
context: .. context: ..
dockerfile: alm/Dockerfile dockerfile: alm/Dockerfile
ports:
- "${PORT}:${PORT}"
env_file: ./.env env_file: ./.env
environment: environment:
- NODE_ENV=production - NODE_ENV=production
restart: unless-stopped restart: unless-stopped
entrypoint: yarn start entrypoint: serve -p ${PORT} -s .

@ -26,7 +26,8 @@
"react-scripts": "3.0.1", "react-scripts": "3.0.1",
"styled-components": "^5.1.1", "styled-components": "^5.1.1",
"typescript": "^3.5.2", "typescript": "^3.5.2",
"web3": "1.2.7" "web3": "1.2.7",
"web3-eth-contract": "1.2.7"
}, },
"scripts": { "scripts": {
"start": "./load-env.sh react-app-rewired start", "start": "./load-env.sh react-app-rewired start",

@ -70,7 +70,7 @@ export const fetchAccountTransactionsFromBlockscout = async ({
} }
export const getBlockByTimestampUrl = (api: string, timestamp: number) => export const getBlockByTimestampUrl = (api: string, timestamp: number) =>
`${api}?module=block&action=getblocknobytime&timestamp=${timestamp}&closest=before` `${api}&module=block&action=getblocknobytime&timestamp=${timestamp}&closest=before`
export const fetchAccountTransactionsFromEtherscan = async ({ export const fetchAccountTransactionsFromEtherscan = async ({
account, account,
@ -101,7 +101,7 @@ export const fetchAccountTransactionsFromEtherscan = async ({
return [] return []
} }
const url = `${api}?module=account&action=txlist&address=${account}&startblock=${fromBlock}&endblock=${toBlock}` const url = `${api}&module=account&action=txlist&address=${account}&startblock=${fromBlock}&endblock=${toBlock}`
try { try {
const result = await fetch(url).then(res => res.json()) const result = await fetch(url).then(res => res.json())