Skip to content

Build and Deployment

This page describes the build and deployment process for OpsAnt.

Local Pre-build

For each release, first build the frontend and opsmini-server locally and commit them to git.

Frontend

cd frontend
npm run build

The build artifacts are output to static/opsant/, and the SPA entry is automatically written to templates/opsant/index.html.

opsmini-server (Go)

export PATH=/Users/vicky/go-sdk125/go/bin:$PATH GOPROXY=https://goproxy.cn,direct
cd opsmini-server
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/opsmini-server-linux-amd64 ./cmd/opsmini-server
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o bin/opsmini-server-linux-arm64 ./cmd/opsmini-server

Commit the artifacts:

git add -A && git commit -m "build: 预构建前端 + opsmini-server"

Build Image

The build context is the parent directory of the source directory (where opsant/ is the source directory):

cd /opt
docker build -f opsant/docker/Dockerfile -t registry.cn-beijing.aliyuncs.com/opsany/opsany-proxy-opsant:2.3.5 .

# arm64 架构
docker build -f opsant/docker/Dockerfile-arm64 -t registry.cn-beijing.aliyuncs.com/opsany/opsany-proxy-opsant:2.3.5-arm64 .

Upgrade

Use the upgrade script to pull the new image and rebuild the container:

cd /opt/opsant/install
./opsant-update.sh proxy 2.3.5

Notes

  • Both the frontend and opsmini-server are pre-built and committed locally; no compilation occurs inside the image
  • It is recommended to complete database migration and backup before release