From f089a6051e40a5ded40c6ea2192abfa857e550a3 Mon Sep 17 00:00:00 2001 From: Armin Friedl Date: Thu, 21 May 2020 19:17:28 +0200 Subject: [PATCH] Hastebin rolling release Add first test files for a hastebin build from master Signed-off-by: Armin Friedl --- .drone.yml | 25 +++++++++++++++++++++++++ latest/Dockerfile | 27 +++++++++++++++++++++++++++ latest/config.js | 31 +++++++++++++++++++++++++++++++ latest/run.sh | 8 ++++++++ 4 files changed, 91 insertions(+) create mode 100644 .drone.yml create mode 100644 latest/Dockerfile create mode 100644 latest/config.js create mode 100644 latest/run.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..471768f --- /dev/null +++ b/.drone.yml @@ -0,0 +1,25 @@ +kind: pipeline +type: docker +name: latest + +steps: +- name: publish + image: plugins/docker + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + dockerfile: latest/Dockerfile + context: latest/ + build-args: + - HASTEBIN_VERSION=master + purge: true + repo: arminfriedl/hastebin + tags: latest + +trigger: + event: + - cron + cron: + - hourly diff --git a/latest/Dockerfile b/latest/Dockerfile new file mode 100644 index 0000000..4a61356 --- /dev/null +++ b/latest/Dockerfile @@ -0,0 +1,27 @@ +FROM node:current-alpine + +ARG HASTEBIN_VERSION +ENV UID=1005 GID=1005 + +COPY run.sh /usr/local/bin/run.sh + +RUN apk -U upgrade \ + && apk --no-cache add git su-exec \ + && git clone https://github.com/seejohnrun/haste-server.git /app \ + && cd app \ + && git checkout ${HASTEBIN_VERSION} \ + && npm install \ + && npm cache clean --force \ + && apk del git \ + && rm -rf /var/lib/apk/* /var/cache/apk/* \ + && chmod +x /usr/local/bin/run.sh + +# we cannot copy this before the RUN because +# git clone will fail if app/ is not empty +COPY config.js /app/config.js + +WORKDIR /app +VOLUME /app/data +EXPOSE 7777 + +ENTRYPOINT ["run.sh"] diff --git a/latest/config.js b/latest/config.js new file mode 100644 index 0000000..7141ba1 --- /dev/null +++ b/latest/config.js @@ -0,0 +1,31 @@ +{ + "host": "0.0.0.0", + "port": 7777, + "keyLength": 10, + "maxLength": 400000, + "staticMaxAge": 86400, + "recompressStaticAssets": true, + "logging": [{ + "level": "error", + "type": "Console", + "colorize": true + }], + "keyGenerator": { + "type": "phonetic" + }, + "rateLimits": { + "categories": { + "normal": { + "totalRequests": 500, + "every": 60000 + } + } + }, + "storage": { + "type": "file", + "path": "./data" + }, + "documents": { + "about": "./about.md" + } +} diff --git a/latest/run.sh b/latest/run.sh new file mode 100644 index 0000000..d5b4567 --- /dev/null +++ b/latest/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -xe + +# we have to run the chown here since the VOLUME is mounted +# after the build with root:root +chown -R ${UID}:${GID} /app +su-exec ${UID}:${GID} npm start