-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploy new ten gateway frontend #1686
Changes from 4 commits
0d7f282
e6b8030
13d1096
14a0570
fbc1dbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,13 +9,18 @@ FROM golang:1.20-alpine as system | |||||||||
# set the base libs to build / run | ||||||||||
RUN apk add build-base bash git | ||||||||||
ENV CGO_ENABLED=1 | ||||||||||
ARG TESTNET_TYPE | ||||||||||
|
||||||||||
# Standard build stage that initializes the go dependencies | ||||||||||
FROM system as get-dependencies | ||||||||||
# create the base directory | ||||||||||
# setup container data structure | ||||||||||
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 . | ||||||||||
|
@@ -27,7 +32,22 @@ FROM get-dependencies as build-wallet | |||||||||
# make sure the geth network code is available | ||||||||||
COPY . /home/obscuro/go-obscuro | ||||||||||
|
||||||||||
# build the contract deployer exec | ||||||||||
# 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.obscu.ro" > .env; \ | ||||||||||
elif [ "$TESTNET_TYPE" = "uat-testnet" ]; then \ | ||||||||||
echo "NEXT_PUBLIC_API_GATEWAY_URL=https://uat-testnet.obscu.ro" > .env; \ | ||||||||||
elif [ "$TESTNET_TYPE" = "sepolia-testnet" ]; then \ | ||||||||||
echo "NEXT_PUBLIC_API_GATEWAY_URL=https://testnet.obscu.ro" > .env; \ | ||||||||||
else \ | ||||||||||
echo "NEXT_PUBLIC_API_GATEWAY_URL=http://127.0.0.1:3000" > .env; \ | ||||||||||
fi | ||||||||||
Comment on lines
+36
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||||||
# Run npm build for frontend | ||||||||||
RUN npm install | ||||||||||
RUN npm run build | ||||||||||
Comment on lines
+47
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using - RUN npm install
+ RUN npm ci Committable suggestion
Suggested change
|
||||||||||
|
||||||||||
# build the gateway executable | ||||||||||
WORKDIR /home/obscuro/go-obscuro/tools/walletextension/main | ||||||||||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||||||||||
go build -o ../bin/wallet_extension_linux | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,11 @@ import ( | |
"github.com/ten-protocol/go-ten/tools/walletextension/common" | ||
) | ||
|
||
//go:embed static | ||
//go:embed staticOG | ||
//go:embed all:static | ||
var staticFiles embed.FS | ||
|
||
const ( | ||
staticDir = "static" | ||
staticDirOG = "staticOG" | ||
staticDir = "static" | ||
) | ||
|
||
// Server is a wrapper for the http server | ||
|
@@ -67,13 +65,7 @@ func createHTTPServer(address string, routes []Route) *http.Server { | |
if err != nil { | ||
panic(fmt.Sprintf("could not serve static files. Cause: %s", err)) | ||
} | ||
serveMux.Handle(common.PathViewingKeys, http.StripPrefix(common.PathViewingKeys, http.FileServer(http.FS(noPrefixStaticFiles)))) | ||
|
||
noPrefixStaticFilesOG, err := fs.Sub(staticFiles, staticDirOG) | ||
if err != nil { | ||
panic(fmt.Errorf("could not serve static files. Cause: %w", err).Error()) | ||
} | ||
serveMux.Handle(common.PathObscuroGateway, http.StripPrefix(common.PathObscuroGateway, http.FileServer(http.FS(noPrefixStaticFilesOG)))) | ||
serveMux.Handle(common.PathObscuroGateway, http.StripPrefix(common.PathObscuroGateway, http.FileServer(http.FS(noPrefixStaticFiles)))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The static files are now served at the The verification script did not find a definition for
|
||
|
||
// Creates the actual http server with a ReadHeaderTimeout to avoid Potential Slowloris Attack | ||
server := &http.Server{Addr: address, Handler: serveMux, ReadHeaderTimeout: common.ReaderHeadTimeout} | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if-else block is pretty gross but not a priority haha.