Compare commits
No commits in common. "master" and "master" have entirely different histories.
43
.drone.yml
43
.drone.yml
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: Production
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Build Dockerfile
|
- name: Build Dockerfile
|
||||||
|
@ -14,47 +14,6 @@ steps:
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
repo: fbrinker/tileboard
|
repo: fbrinker/tileboard
|
||||||
dockerfile: Dockerfile
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Development
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check for changes in master branch
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- apk update && apk add bash curl grep jq sed
|
|
||||||
- ./check-master-for-changes.sh
|
|
||||||
|
|
||||||
- name: Build & Publish Development Image
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
repo: fbrinker/tileboard
|
|
||||||
dockerfile: Dockerfile.nightly
|
|
||||||
target: dev
|
|
||||||
tags: dev
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
||||||
|
|
||||||
- name: Build & Publish Nightly Image
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
repo: fbrinker/tileboard
|
|
||||||
dockerfile: Dockerfile.nightly
|
|
||||||
target: nightly
|
|
||||||
tags: nightly
|
|
||||||
username:
|
username:
|
||||||
from_secret: docker_username
|
from_secret: docker_username
|
||||||
password:
|
password:
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
## DEVELOPMENT IMAGE
|
|
||||||
FROM node:15-alpine AS dev
|
|
||||||
|
|
||||||
# Install pre-requisites
|
|
||||||
RUN apk add --no-cache git python3
|
|
||||||
|
|
||||||
# Fetch and build tileboard master branch
|
|
||||||
RUN mkdir /tileboard-source \
|
|
||||||
&& cd /tileboard-source/ \
|
|
||||||
&& git clone https://github.com/resoai/TileBoard . \
|
|
||||||
&& git checkout -b my-patch origin/master \
|
|
||||||
&& mkdir /tileboard \
|
|
||||||
&& ln -s /tileboard build \
|
|
||||||
&& yarn install \
|
|
||||||
&& yarn run build
|
|
||||||
|
|
||||||
# Start Server
|
|
||||||
WORKDIR /tileboard
|
|
||||||
EXPOSE 8000
|
|
||||||
EXPOSE 8080
|
|
||||||
ENTRYPOINT ["/bin/sh", "-c", "yarn --cwd /tileboard-source run dev & python3 -m http.server"]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NIGHTLY BUILD IMAGE
|
|
||||||
FROM python:alpine AS nightly
|
|
||||||
|
|
||||||
# Copy contents from dev image
|
|
||||||
COPY --from=dev /tileboard /tileboard
|
|
||||||
|
|
||||||
# Start Server
|
|
||||||
WORKDIR /tileboard
|
|
||||||
EXPOSE 8000
|
|
||||||
ENTRYPOINT python3 -m http.server
|
|
|
@ -1,9 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
@ -27,11 +27,6 @@ Besides the latest version, you can listen to updates for a specific version:
|
||||||
* fbrinker/tileboard:2.2
|
* fbrinker/tileboard:2.2
|
||||||
* fbrinker/tileboard:2.2.0
|
* fbrinker/tileboard:2.2.0
|
||||||
|
|
||||||
Additionally, there are `nightly` and `dev` builds as follows:
|
|
||||||
* `fbrinker/tileboard:nightly` contains a nightly build of TileBoard's `master` branch. Use it to have the most bleeding edge changes, which have not made it into a release yet.
|
|
||||||
* `fbrinker/tileboard:dev` bundles TileBoard's source code and runs `yarn run dev` inside the container. Use it to modify the source, check your changes into GitHub and propose a pull request to TileBoard. See the TileBoard [contribution page](https://github.com/resoai/TileBoard/blob/master/CONTRIBUTING.md) for details.
|
|
||||||
|
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
Here is an example, using Docker-Compose:
|
Here is an example, using Docker-Compose:
|
||||||
|
|
37
build.sh
37
build.sh
|
@ -1,40 +1,36 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
getVersionFromLatestRelease() {
|
getVersionFromLatestRelease() {
|
||||||
repo="${1-resoai/TileBoard}"
|
version=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
|
||||||
version=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
|
|
||||||
| grep "tag_name" \
|
| grep "tag_name" \
|
||||||
| cut -d '"' -f 4 \
|
| cut -d '"' -f 4 \
|
||||||
| sed -e "s/v//"`
|
| sed -e "s/v//"`
|
||||||
|
|
||||||
echo "$version"
|
echo "$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
getDownloadUrl() {
|
getDownloadUrl() {
|
||||||
repo="${1-resoai/TileBoard}"
|
url=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
|
||||||
url=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
|
|
||||||
| grep "browser_download_url" \
|
| grep "browser_download_url" \
|
||||||
| cut -d '"' -f 4`
|
| cut -d '"' -f 4`
|
||||||
|
|
||||||
echo "$url"
|
echo "$url"
|
||||||
}
|
}
|
||||||
|
|
||||||
docker_tag_exists() {
|
getLatestPublishedTag() {
|
||||||
repo="${1-fbrinker/tileboard}"
|
latest_tag=`curl -s "https://hub.docker.com/v2/repositories/fbrinker/tileboard/tags?page_size=1" \
|
||||||
tag="${2-latest}"
|
| jq -r ".results[0].name"`
|
||||||
curl --silent -f -lSL "https://hub.docker.com/v2/repositories/$repo/tags/$tag" > /dev/null 2>&1
|
|
||||||
|
echo "$latest_tag"
|
||||||
}
|
}
|
||||||
|
|
||||||
source_repo="${1-resoai/TileBoard}"
|
LATEST_RELEASE=`getVersionFromLatestRelease`
|
||||||
docker_repo="${2-fbrinker/tileboard}"
|
LATEST_TAG=`getLatestPublishedTag`
|
||||||
echo "Source repository: $source_repo."
|
|
||||||
echo "Docker repository: $docker_repo."
|
|
||||||
|
|
||||||
LATEST_RELEASE=`getVersionFromLatestRelease $source_repo`
|
if [ "$LATEST_RELEASE" = "$LATEST_TAG" ]; then
|
||||||
echo "Latest release is: $LATEST_RELEASE."
|
echo "Nothing to do. Versions already match."
|
||||||
|
echo "Release: $LATEST_RELEASE"
|
||||||
if docker_tag_exists $docker_repo $LATEST_RELEASE; then
|
echo "Tag: $LATEST_TAG"
|
||||||
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
|
||||||
|
|
||||||
|
@ -46,7 +42,6 @@ PATCH=$LATEST_RELEASE
|
||||||
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
|
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
|
||||||
|
|
||||||
RELEASE_URL=`getDownloadUrl`
|
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
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
docker_tag_exists() {
|
|
||||||
repo="${1-fbrinker/tileboard}"
|
|
||||||
tag="${2-nightly}"
|
|
||||||
curl --silent -f -lSL "https://hub.docker.com/v2/repositories/$repo/tags/$tag" > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
commitdate=$(curl -sL "https://api.github.com/repos/resoai/TileBoard/commits/master" | jq -r ".commit.author.date" | sed 's/T/ /; s/Z//')
|
|
||||||
commitdays=$(( ( $(date --utc +%s) - $(date --utc -d "$commitdate" +%s) ) / 86400 ))
|
|
||||||
echo "Last commit was $commitdate and is $commitdays days ago."
|
|
||||||
|
|
||||||
if [ $commitdays -lt 2 ]; then
|
|
||||||
echo "Found recent commits in the repository."
|
|
||||||
echo "Continuing with pipeline..."
|
|
||||||
elif [ !docker_tag_exists ]; then
|
|
||||||
echo "Missing an nightly build."
|
|
||||||
echo "Continuing with pipeline..."
|
|
||||||
else
|
|
||||||
echo "No recent commits found."
|
|
||||||
echo "Aborting pipeline."
|
|
||||||
exit 78 # drone.io exit code to stop but success the pipeline
|
|
||||||
fi
|
|
Reference in New Issue