Compare commits

...
This repository has been archived on 2021-06-21. You can view files and clone it, but cannot push or open issues or pull requests.

8 Commits

Author SHA1 Message Date
Florian Brinker 7acbe3d55e Fix date handling for ISO8601 dates
continuous-integration/drone/push Build is passing Details
2021-05-10 22:03:02 +02:00
akloeckner 6595011075 feature: nightly and dev images (#5)
continuous-integration/drone/push Build was killed Details
continuous-integration/drone Build is passing Details
So, here we go with a PR for the nightly images. **They will need to have a nightly (at least) run of the pipeline.**

I have also included a script and modifications to `drone.yml`, which I believe should serve well as a check-for-changes. But I have no way to check this in your drone environment. ~~And I have not (yet) checked it locally, either. I just copied things over from my GitHub setup.~~ (Update: The script works for me locally.)

Could you have a look and let me know, what needs to be changed from your point of view?

(I don't know Gitea too well... If there's an option to let you write into this feature branch, I'll enable it.)

fixes #4

Co-authored-by: dev-docker <akloeckner@users.noreply.github.com>
Co-authored-by: Florian Brinker <mail+gitlab@f-brinker.de>
Reviewed-on: fbrinker/docker-tileboard#5
Co-authored-by: akloeckner <akloeckner@noreply.example.org>
Co-committed-by: akloeckner <akloeckner@noreply.example.org>
2021-05-10 19:23:50 +00:00
Florian Brinker 569622b11f prepare seperate development pipeline
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2021-05-10 18:37:09 +02:00
Florian Brinker 5d14177f58 Change "target" label to "docker" 2021-05-10 18:23:41 +02:00
Florian Brinker 9aaa9acca9 Merge pull request 'fix: make build.sh not rely on tag being latest' (#6) from akloeckner/fbrinker-tileboard:feat-repos into master
continuous-integration/drone/push Build is passing Details
Reviewed-on: fbrinker/docker-tileboard#6
2021-05-10 16:11:01 +00:00
Florian Brinker f3e64254f5 Merge branch 'master' into feat-repos 2021-05-10 16:10:24 +00:00
dev-docker 6aec325301 fix: make build.sh not rely on tag being latest
This introduces:
* an explicit check for the existence of the latest version tag
  * This way, we don't need to bother to have `nightly` or `dev` tags in place. The new check works by `curl` failing, if the target tag does not exist.
* more verbose output
  * This was just for debugging actually, but I believe it might help in the future.
* input parameters to the `build.sh` script
  * This allows for using the script also from other repos. I'd like to keep trying things without having to ask you for checking in Drone.io...
2021-05-10 15:17:20 +00:00
Florian Brinker 30d493b87a Add license 2021-05-09 21:45:13 +00:00
6 changed files with 134 additions and 17 deletions

View File

@ -1,7 +1,7 @@
---
kind: pipeline
type: docker
name: default
name: Production
steps:
- name: Build Dockerfile
@ -14,6 +14,47 @@ steps:
image: plugins/docker
settings:
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:
from_secret: docker_username
password:

34
Dockerfile.nightly Normal file
View File

@ -0,0 +1,34 @@
## 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

9
LICENSE.md Normal file
View File

@ -0,0 +1,9 @@
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.

View File

@ -27,6 +27,11 @@ Besides the latest version, you can listen to updates for a specific version:
* fbrinker/tileboard:2.2
* 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
Here is an example, using Docker-Compose:

View File

@ -1,36 +1,40 @@
#!/usr/bin/env bash
getVersionFromLatestRelease() {
version=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
repo="${1-resoai/TileBoard}"
version=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
| grep "tag_name" \
| cut -d '"' -f 4 \
| sed -e "s/v//"`
echo "$version"
}
getDownloadUrl() {
url=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
repo="${1-resoai/TileBoard}"
url=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
| grep "browser_download_url" \
| cut -d '"' -f 4`
echo "$url"
}
getLatestPublishedTag() {
latest_tag=`curl -s "https://hub.docker.com/v2/repositories/fbrinker/tileboard/tags?page_size=1" \
| jq -r ".results[0].name"`
echo "$latest_tag"
docker_tag_exists() {
repo="${1-fbrinker/tileboard}"
tag="${2-latest}"
curl --silent -f -lSL "https://hub.docker.com/v2/repositories/$repo/tags/$tag" > /dev/null 2>&1
}
LATEST_RELEASE=`getVersionFromLatestRelease`
LATEST_TAG=`getLatestPublishedTag`
source_repo="${1-resoai/TileBoard}"
docker_repo="${2-fbrinker/tileboard}"
echo "Source repository: $source_repo."
echo "Docker repository: $docker_repo."
if [ "$LATEST_RELEASE" = "$LATEST_TAG" ]; then
echo "Nothing to do. Versions already match."
echo "Release: $LATEST_RELEASE"
echo "Tag: $LATEST_TAG"
LATEST_RELEASE=`getVersionFromLatestRelease $source_repo`
echo "Latest release is: $LATEST_RELEASE."
if docker_tag_exists $docker_repo $LATEST_RELEASE; then
echo "Nothing to do. Latest release tag already exists."
exit 78 # drone.io exit code to stop but success the pipeline
fi
@ -42,6 +46,7 @@ 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

23
check-master-for-changes.sh Executable file
View File

@ -0,0 +1,23 @@
#!/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