Skip to content
/ noc Public

Commit 6b84065

Browse files
authored
Build UI in docker container (#47)
1 parent 920f739 commit 6b84065

2 files changed

Lines changed: 63 additions & 4 deletions

File tree

Dockerfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ RUN \
1616
iproute2 \
1717
&& (curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh)
1818

19+
# Build web
20+
FROM node:22-trixie-slim AS build-ui
21+
COPY . /opt/noc
22+
WORKDIR /opt/noc
23+
RUN\
24+
set -x\
25+
&& apt-get update\
26+
&& apt-get install -y --no-install-recommends \
27+
bzip2 \
28+
curl \
29+
ca-certificates \
30+
&& ./scripts/build/build-ui
31+
1932
# Base layer containing system packages and requirements
2033
FROM python AS code
2134
ENV\
@@ -25,14 +38,11 @@ ENV\
2538
NOC_LISTEN="auto:1200" \
2639
PROJ_DIR=/usr
2740
COPY . /opt/noc/
41+
COPY --from=build-ui /opt/noc/ui/dist/ /www/
2842
WORKDIR /opt/noc/
2943
RUN \
3044
set -x \
3145
&& uv pip install --system -e .[bh,activator,classifier,cache-redis,node,login-ldap,login-pam,login-radius,prod-tools,testing,sender-kafka,ping] \
32-
&& python3 ./scripts/deploy/install-packages requirements/web.json \
33-
&& python3 ./scripts/deploy/install-packages requirements/card.json \
34-
&& python3 ./scripts/deploy/install-packages requirements/bi.json \
35-
&& python3 ./scripts/deploy/install-packages requirements/theme-noc.json \
3646
&& (curl -L https://get.static-web-server.net/ | sed 's/sudo //g' | sh) \
3747
&& find /opt/noc/ -type f -name "*.py" -print0 | xargs -0 python3 -m py_compile \
3848
&& uv cache clean \

scripts/build/build-ui

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/sh
2+
# ----------------------------------------------------------------------
3+
# Build UI bundle
4+
# ----------------------------------------------------------------------
5+
# Copyright (C) 2007-2025 The NOC Project
6+
# See LICENSE for details
7+
# ----------------------------------------------------------------------
8+
set -e -x
9+
10+
CDN=https://cdn.getnoc.com/npkg
11+
PKGS="
12+
extjs@6.0.1
13+
bootstrap@3.3.7
14+
joint@2.1.2
15+
joint.layout.directedgraph@2.1.2
16+
dagre@0.7.4
17+
graphlib@1.0.7
18+
jquery@3.1.1
19+
jquery.tablesorter@1.0.0
20+
jquery.table2csv@1.0.0
21+
lodash@3.10.1
22+
backbone@1.3.3
23+
fontawesome@4.7.0
24+
fontawesome7@7.0.0
25+
nocsound@1.0.0
26+
handlebars@4.0.5
27+
pdfmake@0.1.71
28+
noc-stencils-cisco@1.0.5
29+
noc-stencils-juniper@1.0.1
30+
noc-stencils-flaticon@1.0.1
31+
jquery.tokeninput@1.1.1
32+
django-media@3.1.8
33+
viz-js@3.7.0
34+
leaflet@1.9.4
35+
theme-noc@1.5.21
36+
"
37+
38+
for pkg in $PKGS; do
39+
name=$(echo "$pkg" | cut -d'@' -f1)
40+
version=$(echo "$pkg" | cut -d'@' -f2-)
41+
curl -L "$CDN/$name%40$version.tar.bz2" | tar jxfv -
42+
done
43+
44+
cd ui/
45+
npm install
46+
npm run build:micromark
47+
npm run build:monaco
48+
npm run prod
49+
npm run vendor

0 commit comments

Comments
 (0)