mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Fix Docker build for develop and publish a /version file
Fixes https://github.com/vector-im/riot-web/issues/10426
This commit is contained in:
parent
b4829fd3d4
commit
726bf35b76
@ -1,5 +1,4 @@
|
|||||||
# Exclude a bunch of stuff which can make the build context a larger than it needs to be
|
# Exclude a bunch of stuff which can make the build context a larger than it needs to be
|
||||||
.git/
|
|
||||||
test/
|
test/
|
||||||
webapp/
|
webapp/
|
||||||
lib/
|
lib/
|
||||||
|
@ -21,6 +21,9 @@ RUN yarn build
|
|||||||
# Copy the config now so that we don't create another layer in the app image
|
# Copy the config now so that we don't create another layer in the app image
|
||||||
RUN cp /src/config.sample.json /src/webapp/config.json
|
RUN cp /src/config.sample.json /src/webapp/config.json
|
||||||
|
|
||||||
|
# Ensure we populate the version file
|
||||||
|
RUN dos2unix /src/scripts/docker-write-version.sh && sh /src/scripts/docker-write-version.sh
|
||||||
|
|
||||||
|
|
||||||
# App
|
# App
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
# Automatically link to develop if we're building develop, but only if the caller
|
||||||
|
# hasn't asked us to build something else
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
if [ $USE_CUSTOM_SDKS == false ] && [ $BRANCH == 'develop' ]
|
||||||
|
then
|
||||||
|
echo "using develop dependencies for react-sdk and js-sdk"
|
||||||
|
USE_CUSTOM_SDKS=true
|
||||||
|
JS_SDK_BRANCH='develop'
|
||||||
|
REACT_SDK_BRANCH='develop'
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $USE_CUSTOM_SDKS == false ]
|
if [ $USE_CUSTOM_SDKS == false ]
|
||||||
then
|
then
|
||||||
echo "skipping react-sdk and js-sdk installs: USE_CUSTOM_SDKS is false"
|
echo "skipping react-sdk and js-sdk installs: USE_CUSTOM_SDKS is false"
|
||||||
|
20
scripts/docker-write-version.sh
Normal file
20
scripts/docker-write-version.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
TAG=$(git describe --dirty --tags)
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
DIST_VERSION=$TAG
|
||||||
|
|
||||||
|
# If the branch comes out as HEAD then we're probably checked out to a tag, so if the thing is *not*
|
||||||
|
# coming out as HEAD then we're on a branch. When we're on a branch, we want to resolve ourselves to
|
||||||
|
# a few SHAs rather than a version.
|
||||||
|
if [ $BRANCH != 'HEAD' ]
|
||||||
|
then
|
||||||
|
REACT_SHA=$(cd node_modules/matrix-react-sdk; git rev-parse --short=12 HEAD)
|
||||||
|
JSSDK_SHA=$(cd node_modules/matrix-js-sdk; git rev-parse --short=12 HEAD)
|
||||||
|
VECTOR_SHA=$(git rev-parse --short=12 HEAD) # use the ACTUAL SHA rather than assume develop
|
||||||
|
DIST_VERSION=$VECTOR_SHA-react-$REACT_SHA-js-$JSSDK_SHA
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $DIST_VERSION > /src/webapp/version
|
Loading…
Reference in New Issue
Block a user