-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathdocker_build.sh
More file actions
72 lines (65 loc) · 2.79 KB
/
Copy pathdocker_build.sh
File metadata and controls
72 lines (65 loc) · 2.79 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
set -e
# Installing Python package manager
python3 -m pip install --upgrade pip
# Install uv first
python3 -m pip install uv
# Install Python dependencies for Waldur MasterMind using lock file
# Use UV_PROJECT_ENVIRONMENT to target system Python (no venv)
export UV_PROJECT_ENVIRONMENT=$(python -c "import sysconfig; print(sysconfig.get_config_var('prefix'))")
# --frozen installs exactly what uv.lock records and never re-resolves, so the
# image matches the lockfile the rest of CI tests against. --no-dev keeps the
# dev group (pytest, pyright, memray, faker, ...) out of a runtime image whose
# test directories are deleted a step earlier.
# `uv sync` installs the project itself, so no separate `uv pip install -e .`
# is needed - and adding one would re-resolve against pyproject.toml, outside
# the lock.
uv sync --frozen --no-dev
# Install gunicorn separately after uv sync to ensure it's available
python3 -m pip install gunicorn==22.0.0
# Download ghostty-web, the browser terminal served by `waldur web_shell`,
# pinned by URL and sha512 in waldur_core/web_shell/assets.py, so containers
# need no network access to serve it. The Dockerfile points
# WALDUR_WEB_SHELL_ASSETS_DIR at the same directory.
WALDUR_WEB_SHELL_ASSETS_DIR=/usr/share/waldur/web-shell python3 -c "from waldur_core.web_shell import assets; assets.fetch()"
cp /etc/waldur/settings.py src/waldur_core/server/settings.py
# Build static assets
mkdir -p /usr/share/waldur/static
cat > tmp_settings.py << EOF
# Minimal settings required for 'collectstatic' command
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.staticfiles',
'jsoneditor',
'waldur_core.landing',
'rest_framework',
'django_filters',
'drf_spectacular',
)
SECRET_KEY = 'tmp'
STATIC_ROOT = '/usr/share/waldur/static'
STATIC_URL = '/static/'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['waldur_core/templates'],
'OPTIONS': {
'context_processors': (
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
),
'loaders': (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
),
},
},
]
EOF
PYTHONPATH="${PYTHONPATH}:/usr/src/waldur" django-admin collectstatic --noinput --settings=tmp_settings