Add Download to Dockerfile for more transparency

This commit is contained in:
Florian Brinker 2021-04-22 22:27:46 +02:00
parent 2c4c532dff
commit 1b88465f3f
3 changed files with 18 additions and 27 deletions

View File

@ -4,14 +4,13 @@ type: docker
name: default name: default
steps: steps:
- name: build - name: Build Dockerfile
image: alpine image: alpine
commands: commands:
- apk update && apk add bash grep sed curl unzip jq - apk update && apk add bash curl grep jq sed
- chmod +x ./build.sh
- ./build.sh - ./build.sh
- name: docker - name: Build & Publish Image
image: plugins/docker image: plugins/docker
settings: settings:
repo: fbrinker/tileboard repo: fbrinker/tileboard

View File

@ -1,8 +1,15 @@
FROM python:alpine FROM python:alpine
LABEL maintainer="mail+docker@f-brinker.de" LABEL maintainer="mail+docker@f-brinker.de"
# Insert Tileboard # Install wget
COPY ./files/ /tileboard/ RUN apk update \
&& apk add ca-certificates wget unzip \
&& update-ca-certificates
# Download TileBoard
RUN wget -q -O release.zip "%RELEASE_URL%" \
&& unzip release.zip -d /tileboard/ \
&& rm release.zip
# Start Server # Start Server
WORKDIR /tileboard WORKDIR /tileboard

View File

@ -9,13 +9,12 @@ getVersionFromLatestRelease() {
echo "$version" echo "$version"
} }
downloadLatestRelease() { getDownloadUrl() {
url=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \ url=`curl -s "https://api.github.com/repos/resoai/TileBoard/releases/latest" \
| grep "browser_download_url" \ | grep "browser_download_url" \
| cut -d '"' -f 4` | cut -d '"' -f 4`
echo "Url: $url"
curl -sL -o $1 ${url} echo "$url"
} }
getLatestPublishedTag() { getLatestPublishedTag() {
@ -32,7 +31,7 @@ if [ "$LATEST_RELEASE" = "$LATEST_TAG" ]; then
echo "Nothing to do. Versions already match." echo "Nothing to do. Versions already match."
echo "Release: $LATEST_RELEASE" echo "Release: $LATEST_RELEASE"
echo "Tag: $LATEST_TAG" echo "Tag: $LATEST_TAG"
exit 78 # drone.io exit code to stop but success the pipeline #exit 78 # drone.io exit code to stop but success the pipeline
fi fi
SEMVER=( ${LATEST_RELEASE//./ } ) SEMVER=( ${LATEST_RELEASE//./ } )
@ -42,21 +41,7 @@ PATCH=$LATEST_RELEASE
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
downloadLatestRelease "files.zip" RELEASE_URL=`getDownloadUrl`
if [ ! -f "./files.zip" ]; then echo "Writing $RELEASE_URL into Dockerfile..."
echo "Download ./files.zip does not exist" sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile
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