Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066618
D7493.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D7493.diff
View Options
diff --git a/docker/services/swh-web/entrypoint.sh b/docker/services/swh-web/entrypoint.sh
--- a/docker/services/swh-web/entrypoint.sh
+++ b/docker/services/swh-web/entrypoint.sh
@@ -5,16 +5,6 @@
source /srv/softwareheritage/utils/pgsql.sh
setup_pgsql
-# when overriding swh-web sources only
-if [[ -d /src/swh-web ]] ; then
- echo "Install and compile swh-web static assets"
- pushd /src/swh-web
- yarn install --frozen-lockfile
- # execute webpack-dev-server in background
- yarn start-dev&
- popd
-fi
-
source /srv/softwareheritage/utils/pyutils.sh
setup_pip
diff --git a/docker/utils/pyutils.sh b/docker/utils/pyutils.sh
--- a/docker/utils/pyutils.sh
+++ b/docker/utils/pyutils.sh
@@ -1,6 +1,5 @@
#!/bin/bash
-
setup_pip () {
echo Using pip from $(which pip)
@@ -8,19 +7,34 @@
tmpdir=`mktemp -d`
pushd /src
for srcrepo in swh-* ; do
- if [ -w $srcrepo ]
- then
- # Install package in editable mode if source directory is writable
- pip install -e $srcrepo
- else
+ if [ ! -w $srcrepo ]; then
+ echo "$srcrepo is read-only; install from a local copy"
# Source directories might not be writeable, but building them writes
# in-tree; so we're copying them to a location guaranteed to be writeable.
rsync -a --chmod=+w $srcrepo $tmpdir/ --exclude "*/__pycache__/" --exclude "*/.tox/" --exclude "*/.hypothesis/"
- pip install $tmpdir/$srcrepo
+ pushd $tmpdir/$srcrepo
+ else
+ pushd $srcrepo
+ fi
+ # Install package in editable mode if source directory is writable
+ pip install -e .
+ # swh-web special case to handle frontend assets compilation
+ if [ -f package.json ]; then
+ yarn install --frozen-lockfile
+ if [ ! -w . ]; then
+ # swh-web source directory is not writable, there is no interest to
+ # use webpack-dev-server as we made a copy of assets source files,
+ # simply compile the assets then
+ yarn build-dev
+ else
+ # webpack-dev-server can be used, web application will be automatically
+ # reloaded in the browser when modifying assets sources (js, css, ...)
+ yarn start-dev&
+ fi
fi
+ popd
done
popd
- rm -rf $tmpdir
fi
echo Installed Python packages:
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 4:07 PM (11 w, 17 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3227544
Attached To
D7493: docker: make yarn run in the local copy of the swh-web source code
Event Timeline
Log In to Comment