From 2b132c46db995fab6c1189ea54cf090e682ffb31 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 22 Feb 2020 16:21:17 +0100 Subject: [PATCH] inital commit --- .drone.jsonnet | 144 +++++++++++++++++++++++++++++++++++++++++++++++++ .drone.yml | 127 +++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 30 +++++++++++ LICENSE | 21 ++++++++ README.md | 7 +++ manifest.tmpl | 12 +++++ overlay/.keep | 0 7 files changed, 341 insertions(+) create mode 100644 .drone.jsonnet create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md create mode 100644 manifest.tmpl create mode 100644 overlay/.keep diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..7a0d6bb --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,144 @@ +local PipelineBuild(arch='amd64') = { + kind: 'pipeline', + name: 'build-' + arch, + platform: { + os: 'linux', + arch: arch, + }, + steps: [ + { + name: 'dryrun', + image: 'plugins/docker', + settings: { + dry_run: true, + dockerfile: 'Dockerfile', + repo: 'xoxys/${DRONE_REPO_NAME}', + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + build_args: [], + }, + when: { + ref: [ + 'refs/pull/**', + ], + }, + }, + { + name: 'publish', + image: 'plugins/docker', + settings: { + auto_tag: true, + auto_tag_suffix: arch, + dockerfile: 'Dockerfile', + repo: 'xoxys/${DRONE_REPO_NAME}', + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + build_args: [], + }, + when: { + ref: [ + 'refs/heads/master', + 'refs/tags/**', + ], + }, + }, + { + name: 'publish-gitea', + image: 'plugins/gitea-release', + settings: { + api_key: { from_secret: 'gitea_token' }, + base_url: 'https://gitea.rknet.org', + overwrite: true, + title: '${DRONE_TAG}', + note: 'CHANGELOG.md', + }, + when: { + ref: ['refs/tags/**'], + }, + }, + ], +}; + +local PipelineNotifications(depends_on=[]) = { + kind: 'pipeline', + name: 'notifications', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + 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', + }, + when: { + status: [ + 'success', + ], + }, + }, + { + 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: '${DRONE_REPO_NAME}', + README_PATH: 'README.md', + SHORT_DESCRIPTION: 'Rootless NGINX - High-performance HTTP server and reverse proxy', + }, + when: { + status: [ + 'success', + ], + }, + }, + { + name: 'matrix', + image: 'plugins/matrix', + settings: { + homeserver: { from_secret: 'matrix_homeserver' }, + roomid: { from_secret: 'matrix_roomid' }, + template: 'Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}', + username: { from_secret: 'matrix_username' }, + password: { from_secret: 'matrix_password' }, + }, + when: { + status: [ + 'success', + 'failure', + ], + }, + }, + ], + trigger: { + ref: [ + 'refs/heads/master', + 'refs/tags/**', + ], + status: [ + 'success', + 'failure', + ], + }, + depends_on: depends_on, +}; + +[ + PipelineBuild(arch='amd64'), + PipelineNotifications(depends_on=[ + 'build-amd64', + ]), +] diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..68b7610 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,127 @@ +--- +kind: pipeline +name: build-amd64 + +platform: + os: linux + arch: amd64 + +steps: +- name: dryrun + image: plugins/docker + settings: + dockerfile: Dockerfile + dry_run: true + password: + from_secret: docker_password + repo: xoxys/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/pull/** + +- name: publish + image: plugins/docker + settings: + auto_tag: true + auto_tag_suffix: amd64 + dockerfile: Dockerfile + password: + from_secret: docker_password + repo: xoxys/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/master + - refs/tags/** + +- name: publish-gitea + image: plugins/gitea-release + settings: + api_key: + from_secret: gitea_token + base_url: https://gitea.rknet.org + note: CHANGELOG.md + overwrite: true + title: ${DRONE_TAG} + when: + ref: + - refs/tags/** + +--- +kind: pipeline +name: notifications + +platform: + os: linux + arch: amd64 + +steps: +- name: manifest + image: plugins/manifest + settings: + ignore_missing: true + password: + from_secret: docker_password + spec: manifest.tmpl + tags: + - ${DRONE_TAG} + - ${DRONE_TAG%-*} + - ${DRONE_TAG%.*} + - ${DRONE_TAG%%.*} + username: + from_secret: docker_username + when: + status: + - success + +- name: readme + image: sheogorath/readme-to-dockerhub + environment: + DOCKERHUB_PASSWORD: + from_secret: docker_password + DOCKERHUB_REPO_NAME: ${DRONE_REPO_NAME} + DOCKERHUB_REPO_PREFIX: xoxys + DOCKERHUB_USERNAME: + from_secret: docker_username + README_PATH: README.md + SHORT_DESCRIPTION: Rootless NGINX - High-performance HTTP server and reverse proxy + when: + status: + - success + +- name: matrix + image: plugins/matrix + settings: + homeserver: + from_secret: matrix_homeserver + password: + from_secret: matrix_password + roomid: + from_secret: matrix_roomid + template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}" + username: + from_secret: matrix_username + when: + status: + - success + - failure + +trigger: + ref: + - refs/heads/master + - refs/tags/** + status: + - success + - failure + +depends_on: +- build-amd64 + +--- +kind: signature +hmac: 217dfce73cdcafb0d08226885c4a2bf400d5295fcb729be0e59055aa686b955d + +... diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..283ac0b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM alpine:3.11 + +LABEL maintainer="Robert Kaussow " \ + org.label-schema.name="alpine" \ + org.label-schema.vcs-url="https://gitea.rknet.org/docker/molecule" \ + org.label-schema.vendor="Robert Kaussow" \ + org.label-schema.schema-version="1.0" + +RUN addgroup -g 101 -S app && \ + adduser -S -D -H -u 101 -h /app -s /sbin/nologin -G app -g app app && \ + apk --update add --virtual .build-deps curl && \ + curl -SsL -o /usr/local/bin/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.5.0/gomplate_linux-amd64-slim && \ + curl -SsL -o /usr/local/bin/supercronic https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-linux-amd64 && \ + curl -SsL -o /usr/local/bin/url-parser https://github.com/xoxys/url-parser/releases/download/v0.1.0/url-parser-0.1.0-linux-amd64 && \ + curl -SsL -o /usr/local/bin/wait-for https://raw.githubusercontent.com/xoxys/wait-for/master/wait-for && \ + chmod 755 /usr/local/bin/gomplate && \ + chmod 755 /usr/local/bin/supercronic && \ + chmod 755 /usr/local/bin/url-parser && \ + chmod 755 /usr/local/bin/wait-for && \ + apk del .build-deps && \ + rm -rf /var/cache/apk/* && \ + rm -rf /tmp/* + +ADD overlay/ / + +EXPOSE 8080 + +STOPSIGNAL SIGTERM + +CMD [] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d449d3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a679541 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# alpine + +[![Build Status](https://drone.rknet.org/api/badges/docker/alpine/status.svg)](https://drone.rknet.org/docker/alpine/) + +Rootless alpine base image.. + +The pre-configured non-root user is a system user named `app` with the UID `101`. There is also a primary group with the same values. diff --git a/manifest.tmpl b/manifest.tmpl new file mode 100644 index 0000000..faf2b86 --- /dev/null +++ b/manifest.tmpl @@ -0,0 +1,12 @@ +image: xoxys/nginx:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - image: xoxys/nginx:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64 + platform: + architecture: amd64 + os: linux diff --git a/overlay/.keep b/overlay/.keep new file mode 100644 index 0000000..e69de29