Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

perf(frontend): :hammer: improve frontend build time (#3653)

Prashant Shahi3d0fbd0065e6
diff --git a/Makefile b/Makefile
index 7d976341c1..d4df55c063 100644
--- a/Makefile
+++ b/Makefile
@@ -37,10 +37,22 @@ LD_FLAGS=-X ${buildHash}=${BUILD_HASH} -X ${buildTime}=${BUILD_TIME} -X ${buildV
DEV_LD_FLAGS=-X ${licenseSignozIo}=${DEV_LICENSE_SIGNOZ_IO}
all: build-push-frontend build-push-query-service
+
+# Steps to build static files of frontend
+build-frontend-static:
+ @echo "------------------"
+ @echo "--> Building frontend static files"
+ @echo "------------------"
+ @cd $(FRONTEND_DIRECTORY) && \
+ rm -rf build && \
+ CI=1 yarn install && \
+ yarn build && \
+ ls -l build
+
# Steps to build and push docker image of frontend
.PHONY: build-frontend-amd64 build-push-frontend
# Step to build docker image of frontend in amd64 (used in build pipeline)
-build-frontend-amd64:
+build-frontend-amd64: build-frontend-static
@echo "------------------"
@echo "--> Building frontend docker image for amd64"
@echo "------------------"
@@ -49,7 +61,7 @@ build-frontend-amd64:
--build-arg TARGETPLATFORM="linux/amd64" .
# Step to build and push docker image of frontend(used in push pipeline)
-build-push-frontend:
+build-push-frontend: build-frontend-static
@echo "------------------"
@echo "--> Building and pushing frontend docker image"
@echo "------------------"
diff --git a/frontend/.dockerignore b/frontend/.dockerignore
index a106e6a11e..840adcb19f 100644
--- a/frontend/.dockerignore
+++ b/frontend/.dockerignore
@@ -1,4 +1,3 @@
node_modules
.vscode
-build
.git
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index 3209052799..ddbf9edc19 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -1,38 +1,17 @@
-# Builder stage
-FROM node:16.15.0 as builder
+FROM nginx:1.25.2-alpine
# Add Maintainer Info
LABEL maintainer="signoz"
-ARG TARGETOS=linux
-ARG TARGETARCH
-
+# Set working directory
WORKDIR /frontend
-# Copy the package.json and .yarnrc files prior to install dependencies
-COPY package.json ./
-# Copy lock file
-COPY yarn.lock ./
-COPY .yarnrc ./
-
-# Install the dependencies and make the folder
-RUN CI=1 yarn install
-
-COPY . .
-
-# Build the project and copy the files
-RUN yarn build
-
-
-FROM nginx:1.25.2-alpine
-
-COPY conf/default.conf /etc/nginx/conf.d/default.conf
-
# Remove default nginx index page
RUN rm -rf /usr/share/nginx/html/*
-# Copy from the stahg 1
-COPY --from=builder /frontend/build /usr/share/nginx/html
+# Copy custom nginx config and static files
+COPY conf/default.conf /etc/nginx/conf.d/default.conf
+COPY build /usr/share/nginx/html
EXPOSE 3301