mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 05:29:04 +08:00
perf(frontend): 🔨 improve frontend build time (#3653)
Signed-off-by: Prashant Shahi <prashant@signoz.io>
This commit is contained in:
parent
05ea814c61
commit
3d0fbd0065
16
Makefile
16
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}
|
DEV_LD_FLAGS=-X ${licenseSignozIo}=${DEV_LICENSE_SIGNOZ_IO}
|
||||||
|
|
||||||
all: build-push-frontend build-push-query-service
|
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
|
# Steps to build and push docker image of frontend
|
||||||
.PHONY: build-frontend-amd64 build-push-frontend
|
.PHONY: build-frontend-amd64 build-push-frontend
|
||||||
# Step to build docker image of frontend in amd64 (used in build pipeline)
|
# Step to build docker image of frontend in amd64 (used in build pipeline)
|
||||||
build-frontend-amd64:
|
build-frontend-amd64: build-frontend-static
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@echo "--> Building frontend docker image for amd64"
|
@echo "--> Building frontend docker image for amd64"
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@ -49,7 +61,7 @@ build-frontend-amd64:
|
|||||||
--build-arg TARGETPLATFORM="linux/amd64" .
|
--build-arg TARGETPLATFORM="linux/amd64" .
|
||||||
|
|
||||||
# Step to build and push docker image of frontend(used in push pipeline)
|
# Step to build and push docker image of frontend(used in push pipeline)
|
||||||
build-push-frontend:
|
build-push-frontend: build-frontend-static
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
@echo "--> Building and pushing frontend docker image"
|
@echo "--> Building and pushing frontend docker image"
|
||||||
@echo "------------------"
|
@echo "------------------"
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
node_modules
|
node_modules
|
||||||
.vscode
|
.vscode
|
||||||
build
|
|
||||||
.git
|
.git
|
||||||
|
@ -1,38 +1,17 @@
|
|||||||
# Builder stage
|
FROM nginx:1.25.2-alpine
|
||||||
FROM node:16.15.0 as builder
|
|
||||||
|
|
||||||
# Add Maintainer Info
|
# Add Maintainer Info
|
||||||
LABEL maintainer="signoz"
|
LABEL maintainer="signoz"
|
||||||
|
|
||||||
ARG TARGETOS=linux
|
# Set working directory
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
WORKDIR /frontend
|
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
|
# Remove default nginx index page
|
||||||
RUN rm -rf /usr/share/nginx/html/*
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
|
|
||||||
# Copy from the stahg 1
|
# Copy custom nginx config and static files
|
||||||
COPY --from=builder /frontend/build /usr/share/nginx/html
|
COPY conf/default.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY build /usr/share/nginx/html
|
||||||
|
|
||||||
EXPOSE 3301
|
EXPOSE 3301
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user