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

View File

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

View File

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

View File

@ -4,12 +4,12 @@ tags:
{{#each build.tags}} {{#each build.tags}}
{{#if this}} {{#if this}}
- {{trimPrefix "v" this}} - {{trimPrefix "v" this}}
- {{trimPrefix "v" this}}-linux-amd64 - {{trimPrefix "v" this}}-amd64
{{/if}} {{/if}}
{{/each}} {{/each}}
{{/if}} {{/if}}
manifests: 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: platform:
architecture: amd64 architecture: amd64
os: linux 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 /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 /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 set -eo pipefail
URL=http://localhost:8080 URL=http://localhost:8080
wget --quiet --tries=1 --spider ${URL} wget --quiet --tries=1 --spider ${URL}