Recreate container build and tagging

This commit is contained in:
Florian Brinker 2021-03-20 18:28:40 +01:00
parent 1d358e39dd
commit 0bdcdfa673
4 changed files with 63 additions and 9 deletions

View File

@ -1,8 +1,15 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: build
image: alpine
commands:
- apk update && apk add bash grep sed curl unzip
- ./build.sh
- name: docker
image: plugins/docker
settings:

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/.tags
/files
/files.zip

View File

@ -1,15 +1,10 @@
FROM python:alpine
LABEL maintainer="mail+docker@f-brinker.de"
MAINTAINER Florian Brinker "mail+docker@f-brinker.de"
# Install Git
RUN apk update && \
apk add --no-cache bash git
# Clone Tileboard
RUN git clone https://github.com/resoai/TileBoard.git /tileboard
# Insert Tileboard
COPY ./files/ /tileboard/
# Start Server
WORKDIR /tileboard
EXPOSE 8000
ENTRYPOINT python3 -m http.server
ENTRYPOINT python3 -m http.server

49
build.sh Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
getVersionFromLatestRelease() {
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"
}
downloadLatestRelease() {
URL=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
| grep "browser_download_url" \
| cut -d '"' -f 4`
echo "Url: $URL"
curl -sL -o $1 ${URL}
}
LATEST=`getVersionFromLatestRelease`
SEMVER=( ${LATEST//./ } )
MAJOR=${SEMVER[0]}
MINOR=${SEMVER[0]}.${SEMVER[1]}
PATCH=$LATEST
echo "test,$MAJOR,$MINOR,$PATCH" > .tags
downloadLatestRelease "files.zip"
if [ ! -f "./files.zip" ]; then
echo "Download ./files.zip does not exist"
exit 1
fi
unzip files.zip -d files
if [ ! -d "./files" ]; then
echo "Directory ./files does not exist"
exit 1
fi
if [ ! -f "./files/index.html" ]; then
echo "File ./files/index.html does not exist"
exit 1
fi
exit 1