From 1f6e3762440167254e59dd7bbc3fb6ad24a3044e Mon Sep 17 00:00:00 2001 From: lizheming Date: Sun, 9 Jan 2022 18:23:52 +0800 Subject: [PATCH] chore: init commit --- Dockerfile | 21 +++++++++++++++++++++ index.js | 9 +++++++++ package.json | 21 +++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 Dockerfile create mode 100644 index.js create mode 100644 package.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ec7d7c4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# https://github.com/nodejs/LTS +FROM node:lts AS build +WORKDIR /app +ENV NODE_ENV production +COPY package.json /app/package.json +RUN set -eux; \ + npm install --production + +FROM node:lts-alpine +WORKDIR /app +ENV TZ Asia/Shanghai +ENV NODE_ENV production +RUN set -eux; \ + apk add --no-cache bash; \ + apk add --no-cache --virtual .build-deps alpine-conf; \ + setup-timezone -z ${TZ}; \ + apk del --no-network .build-deps +COPY --from=build /app . +COPY index.js /app/index.js +EXPOSE 3000 +CMD ["node", "index.js"] \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..71e7d26 --- /dev/null +++ b/index.js @@ -0,0 +1,9 @@ +const Waline = require('@waline/vercel'); + +const app = Waline({ + async postSave(comment) { + // do what ever you want after save comment + }, +}); + +require('http').createServer(app).listen(process.env.PORT || 3000); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..0ee161c --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "railway-starter", + "private": true, + "version": "0.0.0-development", + "description": "An Waline starter repository for deploy to Railway.app", + "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/walinejs/railway-starter.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/walinejs/railway-starter/issues" + }, + "homepage": "https://github.com/walinejs/railway-starter#readme", + "dependencies": { + "@waline/vercel": "^1.5.0" + } +}