From b1fa7f79dbeb3edb4ec1a8861a3b062c037191d1 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Fri, 5 Aug 2022 03:32:42 -0300 Subject: [PATCH] Migrate docker build to work with vitejs structure; small improvements in the process --- Dockerfile | 4 ++-- docs/other-ways-to-run-otterscan.md | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6513ae7..ac412a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:16.16.0-alpine3.15 AS builder WORKDIR /otterscan-build COPY ["package.json", "package-lock.json", "/otterscan-build/"] RUN npm install -COPY ["run-nginx.sh", "tsconfig.json", "craco.config.js", "tailwind.config.js", "/otterscan-build/"] +COPY ["run-nginx.sh", "tsconfig.json", "tsconfig.node.json", "postcss.config.js", "tailwind.config.js", "vite.config.ts", "index.html", "/otterscan-build/"] COPY ["public", "/otterscan-build/public/"] COPY ["src", "/otterscan-build/src/"] RUN npm run build @@ -97,7 +97,7 @@ COPY --from=fourbytesbuilder /signatures /usr/share/nginx/html/signatures/ COPY --from=logobuilder /assets /usr/share/nginx/html/assets/ COPY nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf COPY nginx/nginx.conf /etc/nginx/nginx.conf -COPY --from=builder /otterscan-build/build /usr/share/nginx/html/ +COPY --from=builder /otterscan-build/dist /usr/share/nginx/html/ COPY --from=builder /otterscan-build/run-nginx.sh / WORKDIR / diff --git a/docs/other-ways-to-run-otterscan.md b/docs/other-ways-to-run-otterscan.md index 07e3358..e0b1349 100644 --- a/docs/other-ways-to-run-otterscan.md +++ b/docs/other-ways-to-run-otterscan.md @@ -16,7 +16,7 @@ Clone Otterscan repo and its submodules. Checkout the tag corresponding to your git clone --recurse-submodules https://github.com/wmitsuda/otterscan.git cd otterscan git checkout -DOCKER_BUILDKIT=1 docker build -t otterscan -f Dockerfile . +docker buildx build -t otterscan . ``` This will run the entire build process inside a build container, merge the production build of the React app with the 4bytes and trustwallet assets into the same image format it is published in Docker Hub, but locally under the name `otterscan`. @@ -40,7 +40,7 @@ First, a brief explanation about the app: These instructions are subjected to changes in future for the sake of simplification. -Make sure you have a working node 14/npm 7 installation. +Make sure you have a working node 16/npm 8 installation. By default, it assumes your Erigon `rpcdaemon` processs is serving requests at `http://localhost:8545`. You can customize this URL by changing the `public/config.json` file. diff --git a/package.json b/package.json index c3ca4f2..b1f8e05 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "assets-start": "docker run --rm -p 3001:80 --name otterscan-assets -d -v$(pwd)/4bytes/signatures:/usr/share/nginx/html/signatures/ -v$(pwd)/trustwallet/blockchains/ethereum/assets:/usr/share/nginx/html/assets/1 -v$(pwd)/topic0/with_parameter_names:/usr/share/nginx/html/topic0/ -v$(pwd)/chains/_data/chains:/usr/share/nginx/html/chains/ -v$(pwd)/nginx/nginx.conf:/etc/nginx/nginx.conf -v$(pwd)/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf nginx:1.21.1-alpine", "assets-start-with-param-names": "docker run --rm -p 3001:80 --name otterscan-assets -d -v$(pwd)/4bytes/with_parameter_names:/usr/share/nginx/html/signatures/ -v$(pwd)/trustwallet/blockchains/ethereum/assets:/usr/share/nginx/html/assets/1 -v$(pwd)/topic0/with_parameter_names:/usr/share/nginx/html/topic0/ -v$(pwd)/chains/_data/chains:/usr/share/nginx/html/chains/ -v$(pwd)/nginx/nginx.conf:/etc/nginx/nginx.conf -v$(pwd)/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf nginx:1.21.1-alpine", "assets-stop": "docker stop otterscan-assets", - "docker-build": "DOCKER_BUILDKIT=1 docker build -t otterscan -f Dockerfile .", + "docker-build": "docker buildx build -t otterscan .", "docker-start": "docker run --rm -p 5000:80 --name otterscan -d otterscan", "docker-stop": "docker stop otterscan" },