Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker related updates #127

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
npm-debug.log
build.sh
manifest.sh
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ schnack.json
npm-debug.log
*.sublime-*
.DS_Store
certs/*
certs/*
18 changes: 18 additions & 0 deletions Dockerfile.allplugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:lts-buster

WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm install
RUN npm install @schnack/plugin-auth-github
RUN npm install @schnack/plugin-auth-twitter
RUN npm install @schnack/plugin-auth-google
RUN npm install @schnack/plugin-auth-mastodon
RUN npm install @schnack/plugin-auth-facebook
RUN npm install @schnack/plugin-notify-pushover
RUN npm install @schnack/plugin-notify-sendmail
RUN npm install @schnack/plugin-notify-slack

COPY . .

EXPOSE 3000
CMD ./init.sh
5 changes: 3 additions & 2 deletions Dockerfile → Dockerfile.latest
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM node:boron
FROM node:lts-buster

WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm install
# RUN npm install @schnack/plugin-auth-github

COPY . .

EXPOSE 3000
CMD [ "npm", "run", "server" ]
CMD ./init.sh
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# schnack.js

Forked from schn4ck/schnack, for detailed documentation, please refer there.

This is a docker friendly version with their changes.

I am trying to make it up-to-date as much as possible.

[Schnack](https://dict.leo.org/englisch-deutsch/schnack) is a simple Disqus-like drop-in commenting system written in JavaScript.

- [Documentation](https://schnack.cool/)
Expand Down Expand Up @@ -182,4 +188,4 @@ npm run dev

We're veIf you want to contribute additional **plugins**, check out the source code for the existing plugins first. We happily accept pull requests on [schnack-plugins](https://github.com/schn4ck/schnack-plugins).

This project used [Conventional Commits](https://www.conventionalcommits.org/).
This project used [Conventional Commits](https://www.conventionalcommits.org/).
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

REPO=jasworks/schnack
ARCH=`uname -p`
VARIANT=$1

docker build -t $REPO:$ARCH-$VARIANT -f Dockerfile.$VARIANT .
docker push $REPO:$ARCH-$VARIANT
4 changes: 4 additions & 0 deletions config/plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sample plugin file

#npm install @schnack/plugin-auth-github
#npm install @schnack/plugin-auth-twitter
34 changes: 34 additions & 0 deletions init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Use npm install @schnack/plugin-auth-github to install additional plugins. Plugin list can be found here:
# https://github.com/schn4ck/schnack-plugins

if [ -f config/plugins ]
then
echo "Installing plugins"
source config/plugins
echo "Done installing plugins"
fi

if [ "x$NODE_ENV" = "x" ]
then
NODE_ENV=production
fi

export NODE_ENV

if [ "x$PUID" = "x" ]
then
echo "Run server"
npm run server
else
echo "Creating user $PUID"
useradd -u $PUID -U -d /usr/src/app appuser
if [ $? -ne 0 ]
then
echo "Cannot create user"
exit 1
else
export NODE_ENV && su - appuser -c "export NODE_ENV=$NODE_ENV && cd /usr/src/app && npm run server"
fi
fi
18 changes: 18 additions & 0 deletions manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

REPO=jasworks/schnack
VARIANT=$1

docker manifest create --amend $REPO:$VARIANT \
$REPO:x86_64-$VARIANT \
$REPO:aarch64-$VARIANT

docker manifest inspect $REPO:$VARIANT

echo -n "Ready to push manifest ?"
read ans

if [ $ans = "y" ]
then
docker manifest push $REPO:$VARIANT
fi
4 changes: 2 additions & 2 deletions schnack.tpl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"page_url": "https://blog.example.com/posts/%SLUG%",
"port": 3000,
"database": {
"comments": "comments.db",
"sessions": "sessions.db"
"comments": "data/comments.db",
"sessions": "data/sessions.db"
},
"admins": [1],
"plugins": {
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const crypto = require('crypto');

nconf
.argv()
.file({ file: './schnack.json' })
.file({ file: './config/schnack.json' })
.env()
.defaults({
admins: [1],
Expand Down
68 changes: 68 additions & 0 deletions src/embed/schnack-icons.css

Large diffs are not rendered by default.