Add hack to write params on container start

This commit is contained in:
Willian Mitsuda 2021-07-07 21:57:03 -03:00
parent 7eb91be286
commit d5d5407eee
3 changed files with 12 additions and 1 deletions

View File

@ -1 +1,3 @@
node_modules node_modules
trustwallet
!trustwallet/blockchains/ethereum/assets

View File

@ -1,13 +1,18 @@
FROM node:12.22.3-alpine AS builder FROM node:12.22.3-alpine AS builder
WORKDIR /otterscan-build WORKDIR /otterscan-build
COPY ["package*.json", "tsconfig.json", "craco.config.js", "tailwind.config.js", "/otterscan-build"] COPY ["run-nginx.sh", "package*.json", "tsconfig.json", "craco.config.js", "tailwind.config.js", "/otterscan-build"]
COPY ["src", "/otterscan-build/src"] COPY ["src", "/otterscan-build/src"]
COPY ["public", "/otterscan-build/public"] COPY ["public", "/otterscan-build/public"]
RUN npm install RUN npm install
RUN npm run build RUN npm run build
FROM nginx:1.21.1-alpine FROM nginx:1.21.1-alpine
RUN apk add jq
COPY 4bytes/signatures /usr/share/nginx/html/signatures/ COPY 4bytes/signatures /usr/share/nginx/html/signatures/
COPY trustwallet/blockchains/ethereum/assets /usr/share/nginx/html/assets/ COPY trustwallet/blockchains/ethereum/assets /usr/share/nginx/html/assets/
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /otterscan-build/build /usr/share/nginx/html/ COPY --from=builder /otterscan-build/build /usr/share/nginx/html/
COPY --from=builder /otterscan-build/run-nginx.sh /
WORKDIR /
CMD ["/run-nginx.sh"]

4
run-nginx.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
PARAMS=`echo "{\"erigonURL\": \"$ERIGON_URL\"}" | jq -aRs .`
echo $PARAMS > /usr/share/nginx/html/config.json
nginx -g "daemon off;"