From 7a1b4f82144eb762cae1f0632afb138a0c047ebb Mon Sep 17 00:00:00 2001 From: "Aode (lion)" Date: Wed, 22 Dec 2021 10:40:33 -0600 Subject: [PATCH] Initial CI --- .drone.yml | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++ Check.toml | 9 ++++ Dockerfile | 25 +++++++++ manifest.tmpl | 19 +++++++ 4 files changed, 199 insertions(+) create mode 100644 .drone.yml create mode 100644 Check.toml create mode 100644 Dockerfile create mode 100644 manifest.tmpl diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..0d9d1ae --- /dev/null +++ b/.drone.yml @@ -0,0 +1,146 @@ +kind: pipeline +type: docker +name: publish-amd64 + +platform: + arch: amd64 + +steps: +- name: prepare + image: alpine:latest + commands: + - sed -i'' "s/PINAFORE_VERSION/$(echo "${DRONE_TAG}" | sed 's/^v//' | sed 's/-[[:alnum:]]\+$//')/g" Dockerfile + +- name: push + image: plugins/docker:20 + settings: + username: asonix + password: + from_secret: dockerhub_token + repo: asonix/pinafore + dockerfile: Dockerfile + auto_tag: true + auto_tag_suffix: linux-amd64 + build_args: + - REPO_ARCH=amd64 + +trigger: + event: + - tag + +--- + +kind: pipeline +type: docker +name: publish-arm64v8 + +platform: + arch: amd64 + +steps: +- name: prepare + image: alpine:latest + commands: + - sed -i'' "s/PINAFORE_VERSION/$(echo "${DRONE_TAG}" | sed 's/^v//' | sed 's/-[[:alnum:]]\+$//')/g" Dockerfile + +- name: push + image: plugins/docker:20 + settings: + username: asonix + password: + from_secret: dockerhub_token + repo: asonix/pinafore + dockerfile: Dockerfile + auto_tag: true + auto_tag_suffix: linux-arm64v8 + build_args: + - REPO_ARCH=arm64v8 + +trigger: + event: + - tag + +--- + +kind: pipeline +type: docker +name: publish-arm32v7 + +platform: + arch: amd64 + +steps: +- name: prepare + image: alpine:latest + commands: + - sed -i'' "s/PINAFORE_VERSION/$(echo "${DRONE_TAG}" | sed 's/^v//' | sed 's/-[[:alnum:]]\+$//')/g" Dockerfile + +- name: push + image: plugins/docker:20 + settings: + username: asonix + password: + from_secret: dockerhub_token + repo: asonix/pinafore + dockerfile: Dockerfile + auto_tag: true + auto_tag_suffix: linux-arm32v7 + build_args: + - REPO_ARCH=arm32v7 + +trigger: + event: + - tag + +--- + +kind: pipeline +type: docker +name: manifest + +platform: + arch: amd64 + +steps: +- name: manifest + image: plugins/manifest:1 + settings: + username: asonix + password: + from_secret: dockerhub_token + dump: true + auto_tag: true + ignore_missing: true + spec: manifest.tmpl + + +depends_on: +- publish-amd64 +- publish-arm64v8 +- publish-arm32v7 + +trigger: + event: + - tag + +--- + +kind: pipeline +type: docker +name: cron + +steps: +- name: tag + image: asonix/release-checker:0.1 + pull: always + environment: + GITEA_TOKEN: + from_secret: gitea_token + commands: + - /usr/local/bin/release-checker + +trigger: + event: + - custom + - cron + diff --git a/Check.toml b/Check.toml new file mode 100644 index 0000000..234bdda --- /dev/null +++ b/Check.toml @@ -0,0 +1,9 @@ +[project] +kind = "github" +namespace = "nolanlawson" +repository = "pinafore" + +[gitea] +domain = "git.asonix.dog" +owner = "asonix" +repo = "docker-pinafore" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..573fbf4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +ARG REPO_ARCH + +# Using Alpine to keep the images smaller +FROM $REPO_ARCH/node:alpine + +# Pushing all files into image +WORKDIR /app +ADD https://github.com/nolanlawson/pinafore/archive/vPINAFORE_VERSION.tar.gz /app/pinafore.tar.gz +RUN tar zxf pinafore.tar.gz \ + && mv pinafore-PINAFORE_VERSION/* . \ + && rm -rf pinafore-PINAFORE_VERSION + +# Install Pinafore +RUN yarn --production --pure-lockfile --network-timeout=30000 \ + && yarn build --network-timeout=30000 \ + && yarn cache clean \ + && rm -rf ./src ./docs ./tests ./bin + +# Expose port 4002 +EXPOSE 4002 + +# Setting run-command, using explicit `node` command +# rather than `yarn` or `npm` to use less memory +# https://github.com/nolanlawson/pinafore/issues/971 +CMD PORT=4002 node server.js diff --git a/manifest.tmpl b/manifest.tmpl new file mode 100644 index 0000000..ae9df3d --- /dev/null +++ b/manifest.tmpl @@ -0,0 +1,19 @@ +image: asonix/pinafore:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +manifests: + - + image: asonix/pinafore:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + - + image: asonix/pinafore:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64v8 + platform: + architecture: arm64 + os: linux + variant: v8 + - + image: asonix/pinafore:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm32v7 + platform: + architecture: arm + os: linux + variant: v7