refactoring and versioning fix
Some checks are pending
continuous-integration/drone/push Build is pending

This commit is contained in:
Robert Kaussow 2020-02-22 14:44:39 +01:00
parent 176908c3a9
commit 38dea5e7f7
8 changed files with 132 additions and 148 deletions

View File

@ -1,8 +0,0 @@
.git
.git*
.drone.*
*.md
.dockerignore
Dockerfile
Dockerfile.*
docker-compose.yml

View File

@ -1,44 +1,43 @@
local PipelineBuild(os='linux', arch='amd64') = {
local tag = os + '-' + arch,
local version_tag = os + '-' + arch,
local file_suffix = std.strReplace(version_tag, '-', '.'),
kind: "pipeline",
name: version_tag,
local PipelineBuild(arch='amd64') = {
kind: 'pipeline',
name: 'build-' + arch,
platform: {
os: os,
os: 'linux',
arch: arch,
},
steps: [
{
name: 'dryrun',
image: 'plugins/docker:' + tag,
pull: 'always',
image: 'plugins/docker',
settings: {
dry_run: true,
tags: version_tag,
dockerfile: './Dockerfile.' + file_suffix,
repo: 'xoxys/kanboard',
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
build_args: {
KANBOARD_VERSION: "${DRONE_TAG%-*}",
},
dockerfile: 'Dockerfile',
repo: 'xoxys/$DRONE_REPO_NAME',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
build_args: [
'BUILD_VERSION=${DRONE_TAG%-*}',
],
},
when: {
ref: [
'refs/pull/**',
],
},
},
{
name: 'publish',
image: 'plugins/docker:' + tag,
pull: 'always',
image: 'plugins/docker',
settings: {
auto_tag: true,
auto_tag_suffix: version_tag,
dockerfile: './Dockerfile.' + file_suffix,
repo: 'xoxys/kanboard',
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
build_args: {
KANBOARD_VERSION: "${DRONE_TAG%-*}",
},
auto_tag_suffix: arch,
dockerfile: 'Dockerfile',
repo: 'xoxys/$DRONE_REPO_NAME',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
build_args: [
'BUILD_VERSION=${DRONE_TAG%-*}',
],
},
when: {
ref: [
@ -48,15 +47,14 @@ local PipelineBuild(os='linux', arch='amd64') = {
},
},
{
name: "publish-gitea",
image: "plugins/gitea-release",
pull: "always",
name: 'publish-gitea',
image: 'plugins/gitea-release',
settings: {
api_key: { "from_secret": "gitea_token" },
base_url: "https://gitea.rknet.org",
api_key: { from_secret: 'gitea_token' },
base_url: 'https://gitea.rknet.org',
overwrite: true,
title: "${DRONE_TAG}",
note: "CHANGELOG.md",
title: '${DRONE_TAG}',
note: 'CHANGELOG.md',
},
when: {
ref: ['refs/tags/**'],
@ -66,83 +64,85 @@ local PipelineBuild(os='linux', arch='amd64') = {
};
local PipelineNotifications(depends_on=[]) = {
kind: "pipeline",
name: "notifications",
kind: 'pipeline',
name: 'notifications',
platform: {
os: "linux",
arch: "amd64",
os: 'linux',
arch: 'amd64',
},
steps: [
{
image: "plugins/manifest",
name: "manifest",
pull: "always",
image: 'plugins/manifest',
name: 'manifest',
settings: {
ignore_missing: true,
tags: ["${DRONE_TAG}", "${DRONE_TAG%-*}", "${DRONE_TAG%.*}", "${DRONE_TAG%%.*}"],
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
spec: "./manifest.tmpl",
tags: [
'${DRONE_TAG}',
'${DRONE_TAG%-*}',
'${DRONE_TAG%.*}',
'${DRONE_TAG%%.*}',
],
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'manifest.tmpl',
},
when: {
ref: [
'refs/heads/master',
'refs/tags/**',
status: [
'success',
],
},
},
{
name: "readme",
image: "sheogorath/readme-to-dockerhub",
pull: "always",
name: 'readme',
image: 'sheogorath/readme-to-dockerhub',
environment: {
DOCKERHUB_USERNAME: { from_secret: "docker_username" },
DOCKERHUB_PASSWORD: { from_secret: "docker_password" },
DOCKERHUB_REPO_PREFIX: "xoxys",
DOCKERHUB_REPO_NAME: "kanboard",
README_PATH: "README.md",
SHORT_DESCRIPTION: "Rootless Kanboard - Kanban project management software"
DOCKERHUB_USERNAME: { from_secret: 'docker_username' },
DOCKERHUB_PASSWORD: { from_secret: 'docker_password' },
DOCKERHUB_REPO_PREFIX: 'xoxys',
DOCKERHUB_REPO_NAME: '$DRONE_REPO_NAME',
README_PATH: 'README.md',
SHORT_DESCRIPTION: 'Rootless Kanboard - Kanban project management software',
},
when: {
ref: [
'refs/heads/master',
'refs/tags/**',
status: [
'success',
],
},
},
{
name: "microbadger",
image: "plugins/webhook",
pull: "always",
name: 'matrix',
image: 'plugins/matrix',
settings: {
urls: { from_secret: "microbadger_url" },
},
},
{
image: "plugins/matrix",
name: "matrix",
pull: 'always',
settings: {
homeserver: "https://matrix.rknet.org",
roomid: "MtidqQXWWAtQcByBhH:rknet.org",
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}",
username: { from_secret: "matrix_username" },
password: { from_secret: "matrix_password" },
homeserver: { from_secret: 'matrix_homeserver' },
roomid: { from_secret: 'matrix_roomid' },
template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}',
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
when: {
status: [ "success", "failure" ],
status: [
'success',
'failure',
],
},
},
],
trigger: {
status: [ "success", "failure" ],
ref: [
'refs/heads/master',
'refs/tags/**',
],
status: [
'success',
'failure',
],
},
depends_on: depends_on,
};
[
PipelineBuild(os='linux', arch='amd64'),
PipelineBuild(arch='amd64'),
PipelineNotifications(depends_on=[
"linux-amd64",
])
'build-amd64',
]),
]

View File

@ -1,6 +1,6 @@
---
kind: pipeline
name: linux-amd64
name: build-amd64
platform:
os: linux
@ -8,41 +8,40 @@ platform:
steps:
- name: dryrun
pull: always
image: plugins/docker:linux-amd64
image: plugins/docker
settings:
build_args:
KANBOARD_VERSION: "${DRONE_TAG%-*}"
dockerfile: ./Dockerfile.linux.amd64
- BUILD_VERSION=${DRONE_TAG%-*}
dockerfile: Dockerfile
dry_run: true
password:
from_secret: docker_password
repo: xoxys/kanboard
tags: linux-amd64
repo: xoxys/$DRONE_REPO_NAME
username:
from_secret: docker_username
when:
ref:
- refs/pull/**
- name: publish
pull: always
image: plugins/docker:linux-amd64
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
auto_tag_suffix: amd64
build_args:
KANBOARD_VERSION: "${DRONE_TAG%-*}"
dockerfile: ./Dockerfile.linux.amd64
- BUILD_VERSION=${DRONE_TAG%-*}
dockerfile: Dockerfile
password:
from_secret: docker_password
repo: xoxys/kanboard
repo: xoxys/$DRONE_REPO_NAME
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- "refs/tags/**"
- refs/tags/**
- name: publish-gitea
pull: always
image: plugins/gitea-release
settings:
api_key:
@ -50,10 +49,10 @@ steps:
base_url: https://gitea.rknet.org
note: CHANGELOG.md
overwrite: true
title: "${DRONE_TAG}"
title: ${DRONE_TAG}
when:
ref:
- "refs/tags/**"
- refs/tags/**
---
kind: pipeline
@ -65,57 +64,47 @@ platform:
steps:
- name: manifest
pull: always
image: plugins/manifest
settings:
ignore_missing: true
password:
from_secret: docker_password
spec: ./manifest.tmpl
spec: manifest.tmpl
tags:
- "${DRONE_TAG}"
- "${DRONE_TAG%-*}"
- "${DRONE_TAG%.*}"
- "${DRONE_TAG%%.*}"
- ${DRONE_TAG}
- ${DRONE_TAG%-*}
- ${DRONE_TAG%.*}
- ${DRONE_TAG%%.*}
username:
from_secret: docker_username
when:
ref:
- refs/heads/master
- "refs/tags/**"
status:
- success
- name: readme
pull: always
image: sheogorath/readme-to-dockerhub
environment:
DOCKERHUB_PASSWORD:
from_secret: docker_password
DOCKERHUB_REPO_NAME: kanboard
DOCKERHUB_REPO_NAME: $DRONE_REPO_NAME
DOCKERHUB_REPO_PREFIX: xoxys
DOCKERHUB_USERNAME:
from_secret: docker_username
README_PATH: README.md
SHORT_DESCRIPTION: Rootless Kanboard - Kanban project management software
when:
ref:
- refs/heads/master
- "refs/tags/**"
- name: microbadger
pull: always
image: plugins/webhook
settings:
urls:
from_secret: microbadger_url
status:
- success
- name: matrix
pull: always
image: plugins/matrix
settings:
homeserver: https://matrix.rknet.org
homeserver:
from_secret: matrix_homeserver
password:
from_secret: matrix_password
roomid: MtidqQXWWAtQcByBhH:rknet.org
roomid:
from_secret: matrix_roomid
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
username:
from_secret: matrix_username
@ -125,15 +114,14 @@ steps:
- failure
trigger:
ref:
- refs/heads/master
- refs/tags/**
status:
- success
- failure
depends_on:
- linux-amd64
---
kind: signature
hmac: e4f6bc169c5cf8661b73dd9b921f6facd998f0c3035f29b53998f35315b7af32
- build-amd64
...

View File

@ -2,12 +2,14 @@ FROM xoxys/nginx:latest
LABEL maintainer="Robert Kaussow <mail@geeklabor.de>" \
org.label-schema.name="Kanboard" \
org.label-schema.version="1.2" \
org.label-schema.vcs-url="https://gitea.rknet.org/docker/kanboard" \
org.label-schema.vendor="Robert Kaussow" \
org.label-schema.schema-version="1.0"
ARG KANBOARD_VERSION=master
ARG KANBOARD_TARBALL=https://github.com/kanboard/kanboard/archive/${KANBOARD_VERSION}.tar.gz
ARG BUILD_VERSION=master
ENV KANBOARD_VERSION="${BUILD_VERSION:-master}"
ADD overlay/ /
RUN apk --update add --virtual .build-deps tar curl && \
apk --update add ssmtp mailx php7 php7-phar php7-curl \
@ -17,12 +19,12 @@ RUN apk --update add --virtual .build-deps tar curl && \
rm -rf /var/www/localhost && \
rm -f /etc/php7/php-fpm.d/www.conf && \
mkdir -p /var/www/app && \
curl -SsL ${KANBOARD_TARBALL} | tar xz -C /var/www/app/ --strip-components=1 && \
echo "Installing Kanboard '${KANBOARD_VERSION}' ..." && \
curl -SsL "https://github.com/kanboard/kanboard/archive/${KANBOARD_VERSION}.tar.gz" | tar xz -C /var/www/app/ -X /.tarignore --strip-components=1 && \
curl -SsL -o /etc/php7/browscap.ini https://browscap.org/stream?q=Lite_PHP_BrowsCapINI && \
apk del .build-deps && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/* && \
rm -rf /var/www/app/ChangeLog /var/www/app/config.default.php && \
mkdir -p /var/run/php && \
chown -R nginx /var/run/php && \
mkdir -p /var/lib/php/tmp_upload && \
@ -32,8 +34,6 @@ RUN apk --update add --virtual .build-deps tar curl && \
chown nginx /etc/php7/php.ini && \
chown -R nginx:nginx /var/www/app
ADD overlay/ /
VOLUME /var/www/app/plugins
VOLUME /var/www/app/data
@ -43,7 +43,7 @@ USER nginx
STOPSIGNAL SIGTERM
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD /usr/local/bin/healthcheck.sh
ENTRYPOINT ["/usr/local/bin/entrypoint"]
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD /usr/local/bin/healthcheck
WORKDIR /var/www/app
CMD []

View File

@ -4,12 +4,12 @@ tags:
{{#each build.tags}}
{{#if this}}
- {{trimPrefix "v" this}}
- {{trimPrefix "v" this}}-linux-amd64
- {{trimPrefix "v" this}}-amd64
{{/if}}
{{/each}}
{{/if}}
manifests:
- image: xoxys/kanboard:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
- image: xoxys/kanboard:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
platform:
architecture: amd64
os: linux

2
overlay/.tarignore Normal file
View File

@ -0,0 +1,2 @@
ChangeLog
config.default.php

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/usr/bin/env sh
/usr/local/bin/gomplate -V -o /etc/php7/php.ini -f /etc/templates/php.ini.tmpl
/usr/local/bin/gomplate -V -o /var/www/app/data/config.php -f /etc/templates/config.php.tmpl

View File

@ -1,6 +1,7 @@
#!/bin/sh
#!/usr/bin/env sh
set -eo pipefail
URL=http://localhost:8080
wget --quiet --tries=1 --spider ${URL}