feature: nightly and dev images #5

Merged
fbrinker merged 10 commits from akloeckner/fbrinker-tileboard:feat-nightly into master 2021-05-10 19:23:53 +00:00
4 changed files with 93 additions and 1 deletions

View File

@ -1,7 +1,7 @@
---
kind: pipeline
type: docker
name: production
name: Production
steps:
- name: Build Dockerfile
@ -20,6 +20,46 @@ steps:
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:
from_secret: docker_password
trigger:
branch:
- master

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

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:

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

@ -0,0 +1,13 @@
#!/usr/bin/env bash
commitdate=$(curl -sL "https://api.github.com/repos/resoai/TileBoard/commits/master" | jq -r ".commit.author.date")
commitdays=$(( ( $(date --utc +%s) - $(date --utc -d $commitdate +%s) ) / 86400 ))
echo "Last commit was $commitdays days ago."
if [ $commitdays -lt 2 ] ; then
echo "There ARE recent changes in the repository."
else
echo "There are NO recent changes in the repository."
echo "Aborting pipeline."
exit 78 # drone.io exit code to stop but success the pipeline
fi