Compare commits

...

3 Commits

Author SHA1 Message Date
Gustavo Massaneiro
85edd6e5b0 updated debug.Dockerfile with the latest changes for the ui split build (#691) 2022-01-24 13:52:09 -03:00
RoyUP9
3067bf5eaf Fixed ui split (#690) 2022-01-24 18:11:45 +02:00
RoyUP9
d216c64154 Added support of ui split build (#682) 2022-01-24 10:34:50 +02:00
4 changed files with 13 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ COPY ui/package-lock.json .
RUN npm i
COPY ui .
RUN npm run build
RUN npm run build-ent
FROM golang:1.16-alpine AS builder
# Set necessary environment variables needed for our image.
@@ -54,6 +54,7 @@ WORKDIR /app
COPY --from=builder ["/app/agent-build/mizuagent", "."]
COPY --from=builder ["/app/agent/build/extensions", "extensions"]
COPY --from=site-build ["/app/ui-build/build", "site"]
COPY --from=site-build ["/app/ui-build/build-ent", "site-standalone"]
RUN mkdir /app/data/
# gin-gonic runs in debug mode without this

View File

@@ -247,7 +247,12 @@ func hostApi(socketHarOutputChannel chan<- *tapApi.OutputChannelItem) {
if err := setUIFlags(); err != nil {
logger.Log.Errorf("Error setting ui mode, err: %v", err)
}
app.Use(static.ServeRoot("/", "./site"))
if config.Config.StandaloneMode {
app.Use(static.ServeRoot("/", "./site-standalone"))
} else {
app.Use(static.ServeRoot("/", "./site"))
}
app.Use(middlewares.CORSMiddleware()) // This has to be called after the static middleware, does not work if its called before
@@ -290,8 +295,7 @@ func setUIFlags() error {
return err
}
replacedContent := strings.Replace(string(read), "__IS_STANDALONE__", strconv.FormatBool(config.Config.StandaloneMode), 1)
replacedContent = strings.Replace(replacedContent, "__IS_OAS_ENABLED__", strconv.FormatBool(config.Config.OAS), 1)
replacedContent := strings.Replace(string(read), "__IS_OAS_ENABLED__", strconv.FormatBool(config.Config.OAS), 1)
replacedContent = strings.Replace(replacedContent, "__IS_SERVICE_MAP_ENABLED__", strconv.FormatBool(config.Config.ServiceMap), 1)
err = ioutil.WriteFile(uiIndexPath, []byte(replacedContent), 0)

View File

@@ -8,6 +8,7 @@ COPY ui/package-lock.json .
RUN npm i
COPY ui .
RUN npm run build
RUN npm run build-ent
FROM golang:1.16-alpine AS builder
# Set necessary environment variables needed for our image.
@@ -52,6 +53,7 @@ WORKDIR /app
COPY --from=builder ["/app/agent-build/mizuagent", "."]
COPY --from=builder ["/app/agent/build/extensions", "extensions"]
COPY --from=site-build ["/app/ui-build/build", "site"]
COPY --from=site-build ["/app/ui-build/build-ent", "site-standalone"]
RUN mkdir /app/data/
# install delve

View File

@@ -49,7 +49,8 @@
"scripts": {
"start": "craco start",
"start-ent": "./node_modules/.bin/env-cmd -f .env.enterprise craco start",
"build": "./node_modules/.bin/env-cmd -f .env.basic craco build & BUILD_PATH='./build-ent' ./node_modules/.bin/env-cmd -f .env.enterprise craco build",
"build": "./node_modules/.bin/env-cmd -f .env.basic craco build",
"build-ent": "BUILD_PATH='./build-ent' ./node_modules/.bin/env-cmd -f .env.enterprise craco build",
"test": "craco test",
"eject": "craco eject"
},