forked from fbrinker/docker-tileboard-OUTDATED
feat(RELEASE): allow overriding build.sh
* add `ARG` for `RELEASE_URL` * make `build.sh` prepare `.tags` even if tag exists * add outputs to be used by github workflows
This commit is contained in:
parent
632e04d300
commit
f46f79bd4e
@ -7,11 +7,12 @@ RUN apk update \
|
|||||||
&& update-ca-certificates
|
&& update-ca-certificates
|
||||||
|
|
||||||
# Download TileBoard
|
# Download TileBoard
|
||||||
RUN wget -q -O release.zip "%RELEASE_URL%" \
|
ARG RELEASE_URL
|
||||||
|
RUN wget -q -O release.zip "${RELEASE_URL:-%RELEASE_URL%}" \
|
||||||
&& unzip release.zip -d /tileboard/ \
|
&& unzip release.zip -d /tileboard/ \
|
||||||
&& rm release.zip
|
&& rm release.zip
|
||||||
|
|
||||||
# Start Server
|
# Start Server
|
||||||
WORKDIR /tileboard
|
WORKDIR /tileboard
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
ENTRYPOINT python3 -m http.server
|
ENTRYPOINT python3 -m http.server
|
||||||
|
26
build.sh
26
build.sh
@ -32,21 +32,27 @@ echo "Docker repository: $docker_repo."
|
|||||||
|
|
||||||
LATEST_RELEASE=`getVersionFromLatestRelease $source_repo`
|
LATEST_RELEASE=`getVersionFromLatestRelease $source_repo`
|
||||||
echo "Latest release is: $LATEST_RELEASE."
|
echo "Latest release is: $LATEST_RELEASE."
|
||||||
|
echo "::set-output name=latest_release::$LATEST_RELEASE"
|
||||||
|
|
||||||
|
SEMVER=( ${LATEST_RELEASE//./ } )
|
||||||
|
MAJOR=${SEMVER[0]}
|
||||||
|
MINOR=${SEMVER[0]}.${SEMVER[1]}
|
||||||
|
PATCH=$LATEST_RELEASE
|
||||||
|
echo "::set-output name=major::$MAJOR"
|
||||||
|
echo "::set-output name=minor::$MINOR"
|
||||||
|
echo "::set-output name=patch::$PATCH"
|
||||||
|
|
||||||
|
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
|
||||||
|
echo "::set-output name=tags::$(cat .tags)"
|
||||||
|
|
||||||
|
RELEASE_URL=`getDownloadUrl`
|
||||||
|
echo "URL of release is: $RELEASE_URL."
|
||||||
|
echo "::set-output name=release_url::$RELEASE_URL"
|
||||||
|
|
||||||
if docker_tag_exists $docker_repo $LATEST_RELEASE; then
|
if docker_tag_exists $docker_repo $LATEST_RELEASE; then
|
||||||
echo "Nothing to do. Latest release tag already exists."
|
echo "Nothing to do. Latest release tag already exists."
|
||||||
exit 78 # drone.io exit code to stop but success the pipeline
|
exit 78 # drone.io exit code to stop but success the pipeline
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SEMVER=( ${LATEST_RELEASE//./ } )
|
|
||||||
MAJOR=${SEMVER[0]}
|
|
||||||
MINOR=${SEMVER[0]}.${SEMVER[1]}
|
|
||||||
PATCH=$LATEST_RELEASE
|
|
||||||
|
|
||||||
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
|
|
||||||
|
|
||||||
RELEASE_URL=`getDownloadUrl`
|
|
||||||
echo "URL of release is: $RELEASE_URL."
|
|
||||||
|
|
||||||
echo "Writing release URL into Dockerfile..."
|
echo "Writing release URL into Dockerfile..."
|
||||||
sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile
|
sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile
|
||||||
|
Reference in New Issue
Block a user