sforkowany z fbrinker/docker-tileboard-OUTDATED
Porównaj commity
21 Commity
master
...
akloeckner
Autor | SHA1 | Data | |
---|---|---|---|
|
36b39b251d | ||
|
e89748164b | ||
|
7b8dea218f | ||
|
908898fd98 | ||
|
f46f79bd4e | ||
|
8d55a3741b | ||
|
e427f472eb | ||
|
b14337ef0a | ||
|
27d56a92cf | ||
|
540196b488 | ||
|
632e04d300 | ||
|
64532c2e07 | ||
|
62c33bbc73 | ||
|
7acbe3d55e | ||
6595011075 | |||
|
569622b11f | ||
|
5d14177f58 | ||
9aaa9acca9 | |||
f3e64254f5 | |||
|
6aec325301 | ||
30d493b87a |
45
.drone.yml
45
.drone.yml
@ -1,7 +1,7 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
name: Production
|
||||
|
||||
steps:
|
||||
- name: Build Dockerfile
|
||||
@ -14,6 +14,7 @@ steps:
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: fbrinker/tileboard
|
||||
dockerfile: Dockerfile
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
@ -21,4 +22,44 @@ steps:
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
- 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
|
||||
|
@ -7,11 +7,12 @@ RUN apk update \
|
||||
&& update-ca-certificates
|
||||
|
||||
# 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/ \
|
||||
&& rm release.zip
|
||||
|
||||
# Start Server
|
||||
WORKDIR /tileboard
|
||||
EXPOSE 8000
|
||||
ENTRYPOINT python3 -m http.server
|
||||
ENTRYPOINT python3 -m http.server
|
||||
|
41
Dockerfile.nightly
Normal file
41
Dockerfile.nightly
Normal file
@ -0,0 +1,41 @@
|
||||
## 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
|
9
LICENSE.md
Normal file
9
LICENSE.md
Normal 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.
|
23
README.md
23
README.md
@ -1,6 +1,6 @@
|
||||
# TileBoard Docker-Container
|
||||
|
||||
[![Build Status](https://drone.f-brinker.de/api/badges/fbrinker/docker-tileboard/status.svg)](https://drone.f-brinker.de/fbrinker/docker-tileboard)
|
||||
[![Build Status](https://drone-github.f-brinker.de/api/badges/fbrinker/docker-tileboard/status.svg)](https://drone-github.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://git.f-brinker.de/fbrinker/docker-tileboard/issues).
|
||||
You can open any new issues [here](https://github.com/fbrinker/docker-tileboard/issues).
|
||||
**The builds are automated** on changes of the official TileBoard repository.
|
||||
|
||||
Have a look at the [Dockerfile](https://git.f-brinker.de/fbrinker/docker-tileboard).
|
||||
Have a look at the [Dockerfile](https://github.com/fbrinker/docker-tileboard).
|
||||
|
||||
## Usage
|
||||
|
||||
@ -21,11 +21,18 @@ 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
|
||||
* `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.
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
|
42
build.sh
42
build.sh
@ -1,38 +1,37 @@
|
||||
#!/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"
|
||||
exit 78 # drone.io exit code to stop but success the pipeline
|
||||
fi
|
||||
LATEST_RELEASE=`getVersionFromLatestRelease $source_repo`
|
||||
echo "Latest release is: $LATEST_RELEASE."
|
||||
|
||||
SEMVER=( ${LATEST_RELEASE//./ } )
|
||||
MAJOR=${SEMVER[0]}
|
||||
@ -42,6 +41,13 @@ 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"
|
||||
|
||||
echo "Writing $RELEASE_URL into Dockerfile..."
|
||||
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..."
|
||||
sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile
|
||||
|
23
check-master-for-changes.sh
Executable file
23
check-master-for-changes.sh
Executable 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
|
Reference in New Issue
Block a user