feature: nightly and dev images #5
42
.drone.yml
42
.drone.yml
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: production
|
name: Production
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Build Dockerfile
|
- name: Build Dockerfile
|
||||||
@ -23,3 +23,43 @@ steps:
|
|||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- 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
34
Dockerfile.nightly
Normal 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
|
@ -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
|
||||||
* 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:
|
||||||
|
13
check-master-for-changes.sh
Executable file
13
check-master-for-changes.sh
Executable 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
|
Reference in New Issue
Block a user