Compare commits

..

No commits in common. "akloeckner/deploy" and "master" have entirely different histories.

7 changed files with 30 additions and 158 deletions

View File

@ -1,7 +1,7 @@
---
kind: pipeline
type: docker
name: Production
name: default
steps:
- name: Build Dockerfile
@ -14,7 +14,6 @@ steps:
image: plugins/docker
settings:
repo: fbrinker/tileboard
dockerfile: Dockerfile
username:
from_secret: docker_username
password:
@ -22,44 +21,4 @@ steps:
trigger:
branch:
- main
---
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:
from_secret: docker_password
trigger:
branch:
- main
- master

View File

@ -7,12 +7,11 @@ RUN apk update \
&& update-ca-certificates
# Download TileBoard
ARG RELEASE_URL
RUN wget -q -O release.zip "${RELEASE_URL:-%RELEASE_URL%}" \
RUN wget -q -O release.zip "%RELEASE_URL%" \
&& unzip release.zip -d /tileboard/ \
&& rm release.zip
# Start Server
WORKDIR /tileboard
EXPOSE 8000
ENTRYPOINT python3 -m http.server
ENTRYPOINT python3 -m http.server

View File

@ -1,41 +0,0 @@
## DEVELOPMENT IMAGE
ARG DEVPLATFORM=${TARGETPLATFORM:-linux/amd64}
FROM --platform=$DEVPLATFORM node:15-alpine AS dev
# Install pre-requisites
ARG DEVPLATFORM
RUN echo DEVPLATFORM: $DEVPLATFORM \
&& case $DEVPLATFORM in \
*arm*) apk add --no-cache git python3 build-base ;; \
*) apk add --no-cache git python3 ;; \
esac
# 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 \
&& npm install --global node-sass \
&& 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

View File

@ -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.

View File

@ -1,6 +1,6 @@
# TileBoard Docker-Container
[![Build Status](https://drone-github.f-brinker.de/api/badges/fbrinker/docker-tileboard/status.svg)](https://drone-github.f-brinker.de/fbrinker/docker-tileboard)
[![Build Status](https://drone.f-brinker.de/api/badges/fbrinker/docker-tileboard/status.svg)](https://drone.f-brinker.de/fbrinker/docker-tileboard)
[![Docker Pulls](https://badgen.net/docker/pulls/fbrinker/tileboard?icon=docker&label=pulls)](https://hub.docker.com/r/fbrinker/tileboard)
This is a very basic Docker container for [TileBoard](https://github.com/resoai/TileBoard), "a simple yet highly configurable Dashboard for HomeAssistant".
@ -9,10 +9,10 @@ It contains the sources and starts a simple Python3 webserver to serve TileBoard
### Contribute
You can open any new issues [here](https://github.com/fbrinker/docker-tileboard/issues).
You can open any new issues [here](https://git.f-brinker.de/fbrinker/docker-tileboard/issues).
**The builds are automated** on changes of the official TileBoard repository.
Have a look at the [Dockerfile](https://github.com/fbrinker/docker-tileboard).
Have a look at the [Dockerfile](https://git.f-brinker.de/fbrinker/docker-tileboard).
## Usage
@ -21,18 +21,11 @@ You have to mount your `config.js` file into the `/tileboard` directory of the D
## Versions / Tags
Besides the latest version, you can listen to updates for a specific version:
* `fbrinker/tileboard` *(same as :latest)*
* `fbrinker/tileboard:latest`
* `fbrinker/tileboard:2`
* `fbrinker/tileboard:2.2`
* `fbrinker/tileboard:2.2.0`
### Nightly/Dev-Builds
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.
* fbrinker/tileboard *(same as :latest)*
* fbrinker/tileboard:latest
* fbrinker/tileboard:2
* fbrinker/tileboard:2.2
* fbrinker/tileboard:2.2.0
## Example

View File

@ -1,37 +1,38 @@
#!/usr/bin/env bash
getVersionFromLatestRelease() {
repo="${1-resoai/TileBoard}"
version=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
version=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
| grep "tag_name" \
| cut -d '"' -f 4 \
| sed -e "s/v//"`
echo "$version"
}
getDownloadUrl() {
repo="${1-resoai/TileBoard}"
url=`curl -s "https://api.github.com/repos/$repo/releases/latest" \
url=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
| grep "browser_download_url" \
| cut -d '"' -f 4`
echo "$url"
}
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
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"
}
source_repo="${1-resoai/TileBoard}"
docker_repo="${2-fbrinker/tileboard}"
echo "Source repository: $source_repo."
echo "Docker repository: $docker_repo."
LATEST_RELEASE=`getVersionFromLatestRelease`
LATEST_TAG=`getLatestPublishedTag`
LATEST_RELEASE=`getVersionFromLatestRelease $source_repo`
echo "Latest release is: $LATEST_RELEASE."
if [ "$LATEST_RELEASE" = "$LATEST_TAG" ]; then
echo "Nothing to do. Versions already match."
echo "Release: $LATEST_RELEASE"
echo "Tag: $LATEST_TAG"
exit 78 # drone.io exit code to stop but success the pipeline
fi
SEMVER=( ${LATEST_RELEASE//./ } )
MAJOR=${SEMVER[0]}
@ -41,13 +42,6 @@ PATCH=$LATEST_RELEASE
echo "latest,$MAJOR,$MINOR,$PATCH" > .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
echo "Nothing to do. Latest release tag already exists."
exit 78 # drone.io exit code to stop but success the pipeline
fi
echo "Writing release URL into Dockerfile..."
echo "Writing $RELEASE_URL into Dockerfile..."
sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile

View File

@ -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