Add Download to Dockerfile for more transparency
All checks were successful
continuous-integration/drone Build is passing

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
steps:
- name: build
- name: Build Dockerfile
image: alpine
commands:
- apk update && apk add bash grep sed curl unzip jq
- chmod +x ./build.sh
- apk update && apk add bash curl grep jq sed
- ./build.sh
- name: docker
- name: Build & Publish Image
image: plugins/docker
settings:
repo: fbrinker/tileboard

View File

@ -1,8 +1,15 @@
FROM python:alpine
LABEL maintainer="mail+docker@f-brinker.de"
# Insert Tileboard
COPY ./files/ /tileboard/
# Install wget
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
WORKDIR /tileboard

View File

@ -9,13 +9,12 @@ getVersionFromLatestRelease() {
echo "$version"
}
downloadLatestRelease() {
getDownloadUrl() {
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}
echo "$url"
}
getLatestPublishedTag() {
@ -32,7 +31,7 @@ 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
#exit 78 # drone.io exit code to stop but success the pipeline
fi
SEMVER=( ${LATEST_RELEASE//./ } )
@ -42,21 +41,7 @@ PATCH=$LATEST_RELEASE
echo "latest,$MAJOR,$MINOR,$PATCH" > .tags
downloadLatestRelease "files.zip"
RELEASE_URL=`getDownloadUrl`
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
echo "Writing $RELEASE_URL into Dockerfile..."
sed -i "s|%RELEASE_URL%|$RELEASE_URL|g" ./Dockerfile