From d23542eb53fad00aa7a67c0d4563e3fa6617dde4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Wed, 21 Aug 2024 11:40:41 +0200 Subject: [PATCH] remove serving static frontend files from the gateway --- tools/walletextension/Dockerfile | 25 ---------------- tools/walletextension/api/server.go | 24 ---------------- tools/walletextension/api/static/favicon.ico | Bin 1260 -> 0 bytes tools/walletextension/common/constants.go | 1 - tools/walletextension/entrypoint.sh | 3 -- tools/walletextension/main/main.go | 2 +- tools/walletextension/nginx.conf | 27 ------------------ .../walletextension_container.go | 13 --------- 8 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 tools/walletextension/api/server.go delete mode 100644 tools/walletextension/api/static/favicon.ico delete mode 100644 tools/walletextension/nginx.conf diff --git a/tools/walletextension/Dockerfile b/tools/walletextension/Dockerfile index b399a471dd..5a25543b06 100644 --- a/tools/walletextension/Dockerfile +++ b/tools/walletextension/Dockerfile @@ -18,9 +18,6 @@ FROM system as get-dependencies RUN mkdir -p /home/obscuro/go-obscuro -# Install Node.js and npm (needed for frontend) -RUN apk add --update nodejs npm - # Ensures container layer caching when dependencies are not changed WORKDIR /home/obscuro/go-obscuro COPY go.mod . @@ -32,21 +29,6 @@ FROM get-dependencies as build-wallet # make sure the geth network code is available COPY . /home/obscuro/go-obscuro -# Create .env file for frontend -WORKDIR /home/obscuro/go-obscuro/tools/walletextension/frontend -RUN if [ "$TESTNET_TYPE" = "dev-testnet" ]; then \ - echo "NEXT_PUBLIC_API_GATEWAY_URL=https://dev-testnet.ten.xyz" > .env; \ - elif [ "$TESTNET_TYPE" = "uat-testnet" ]; then \ - echo "NEXT_PUBLIC_API_GATEWAY_URL=https://uat-testnet.ten.xyz" > .env; \ - elif [ "$TESTNET_TYPE" = "sepolia-testnet" ]; then \ - echo "NEXT_PUBLIC_API_GATEWAY_URL=https://testnet.ten.xyz" > .env; \ - else \ - echo "NEXT_PUBLIC_API_GATEWAY_URL=http://127.0.0.1:3000" > .env; \ - fi -# Run npm build for frontend -RUN npm install -RUN npm run build - # build the gateway executable WORKDIR /home/obscuro/go-obscuro/tools/walletextension/main RUN --mount=type=cache,target=/root/.cache/go-build \ @@ -55,19 +37,12 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ # Lightweight final build stage. Includes bare minimum to start wallet extension FROM alpine:3.18 -# Install NGINX -RUN apk update && apk add nginx - # copy over the gateway executable COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/bin /home/obscuro/go-obscuro/tools/walletextension/bin # copy over the .sql migration files COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/storage/database /home/obscuro/go-obscuro/tools/walletextension/storage/database -# copy over the NGINX configuration file -COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/nginx.conf /etc/nginx/nginx.conf - - # copy over the entrypoint script COPY --from=build-wallet /home/obscuro/go-obscuro/tools/walletextension/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh diff --git a/tools/walletextension/api/server.go b/tools/walletextension/api/server.go deleted file mode 100644 index 3552888ae0..0000000000 --- a/tools/walletextension/api/server.go +++ /dev/null @@ -1,24 +0,0 @@ -package api - -import ( - "embed" - "fmt" - "io/fs" - "net/http" -) - -//go:embed all:static -var staticFiles embed.FS - -const ( - staticDir = "static" -) - -func StaticFilesHandler(prefix string) http.Handler { - // Serves the web assets for the management of viewing keys. - fileSystem, err := fs.Sub(staticFiles, staticDir) - if err != nil { - panic(fmt.Sprintf("could not serve static files. Cause: %s", err)) - } - return http.StripPrefix(prefix, http.FileServer(http.FS(fileSystem))) -} diff --git a/tools/walletextension/api/static/favicon.ico b/tools/walletextension/api/static/favicon.ico deleted file mode 100644 index 0e8dea2f715d4fdc30aa83101021fe05fb3e2c21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1260 zcmVg-p z$Qi$Yq(b+^#>V2{-~fAj zdr*R;7$7`6JXjpa4Q5?#Z*NgtT#T`?F~~)-3!R*tFc+fLQ;L<96&xKMp#;e;MBLom zU}|a#+uPf?xVT{1#o5^zCMM$7gYGFWFGo*L50oI;g}%bY#RYM3afpbBKtMnMixmo3 zLy+=yb#-WIX@OEyGe92;3kxJCCnGvK8VLyr@bvW5UaPIGRYiH?4~)dq(-S5qC)q(+ zXK85(K|w)K8(A?RmDkr-wt>aR$7@~f?d=Wg>+4X8A{VNzu10!#`j^+k!^83X{H#5< zv9ZD2+#HJ$qM@MyO-)Tug5nq$8XEetG@ulzYXD(uYm4dWX|@RxN{vt@h_kb^S+%MU zrATrgeVm+}FgQ4fn3x!LuEYpcf_Qj%SdzS@r6pWlUA5U1^G8E_w3kzBqLq}Cr6{Mhw3z70Q zH8rd>CPqg`QCL{`L59-j%*>47ZhU=x&01Fa6@%g|q_2E`e?Lk}N@b&d& zg&gf2hRSieo|BWqo<;SNDCiByJ?!l4xW2wV?j8EiEBisl&CQM5-`{7~`SO9QtgQU@ znVp@T+{42I$2U%*bWl_awYRsUprC;L@9phHX=y22Vf~f&^YdfpKq}r(T7}!xV*d+lvQ;jqgOsMGNMhD$hQc_YN1>IQ>&5}rY-M&}|cXxLb z6%`4}2^x@*k@0C)l?o{?MR_R*8bB@J^71m2@YQ%l4FnCKnj|kT4{K{{_>G7PVlskK z<8S1DKk(DYHh`}%VQe-xHw9&68<3coh>eX67z^q#1_lNM=2)z|lvK^Ye2k!6=`Y#15sDDo^~AAf~3sSQzaipDr&iFYKeAG58Dg W(m0zVdEl%70000