forked from nextgis/nextgisweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.py
More file actions
77 lines (61 loc) · 2.12 KB
/
Copy pathdocker.py
File metadata and controls
77 lines (61 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# // crater >= 2.3.0.dev1
from pathlib import Path
from ngwdocker import PackageBase
from ngwdocker.base import AppImage
from ngwdocker.util import copyfiles
class Package(PackageBase):
pass
@AppImage.on_apt.handler
def on_apt(event):
event.package(
# uWSGI internal routing support
"libpcre3",
"libpcre3-dev",
# For msgfmt and development
"gettext",
)
# Chrome for PDF generation
event.package(
"ghostscript",
"libasound2t64",
"libatk-bridge2.0-0",
"libatk1.0-0",
"libxcomposite1",
"libxdamage1",
"libxfixes3",
"libxrandr2",
"unzip",
)
event.cleanup(
"( : ",
" cd $(mktemp -d)",
" export NPM_CONFIG_UPDATE_NOTIFIER=false",
" export PUPPETEER_CACHE_DIR=$(pwd)",
" path=$(npx --yes @puppeteer/browsers install --format '{{path}}' chrome-headless-shell@stable)",
" cp -a $(dirname $path) /opt/chrome",
" ln -s /opt/chrome/chrome-headless-shell /usr/local/bin/chrome",
" rm -rf $(pwd)",
")",
)
# Enable pnpm, which will be downloaded later
event.cleanup("corepack enable pnpm")
@AppImage.on_user_dir.handler
def on_user_dir(event):
nextgisweb_package = event.image.context.packages["nextgisweb"]
font = nextgisweb_package.settings.get("font")
if font is not None:
fontpath = Path(font)
copyfiles([fontpath], event.source / "build" / "font", fontpath)
@AppImage.on_virtualenv.handler
def on_virtualenv(event):
pip_install = f"{event.path}/bin/pip install --no-cache-dir"
event.before_install(
f"{pip_install} setuptools packaging",
f"gdal_numpy_spec=$(cd package/nextgisweb; {event.path}/bin/python setup.py gdal_numpy_spec)",
f"{pip_install} \"$(echo $gdal_numpy_spec | cut -d ' ' -f 2)\"",
f"{pip_install} --no-build-isolation \"$(echo $gdal_numpy_spec | cut -d ' ' -f 1)\"",
)
event.after_install(
"ln -s package/nextgisweb/.prettierrc.cjs $CRATER_ROOT/",
"ln -s package/nextgisweb/eslint.config.cjs $CRATER_ROOT/",
)