commit 6c5ec13aa1b034a4a691d27b7a7257c7d8b71806 Author: root Date: Fri Nov 3 19:33:40 2017 +0000 first commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e4c85f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +FROM alpine:3.6 + +ARG VERSION=1.16.2 + +ENV GHOST_NODE_VERSION_CHECK=false \ + NODE_ENV=production \ + GID=991 UID=991 \ + ADDRESS=https://my-ghost-blog.com \ + ENABLE_ISSO=False \ + ISSO_HOST=isso.domain.tld \ + ISSO_AVATAR=false \ + ISSO_VOTE=false + +WORKDIR /ghost + +RUN apk -U --no-cache add \ + bash \ + ca-certificates \ + grep \ + libressl \ + nodejs-current \ + nodejs-current-npm \ + s6 \ + su-exec \ + vim \ + && wget -q https://github.com/TryGhost/Ghost/releases/download/${VERSION}/Ghost-${VERSION}.zip -P /tmp \ + && unzip -q /tmp/Ghost-${VERSION}.zip -d /ghost \ + && npm install --production \ + && npm install -g knex-migrator \ + && mv content/themes/casper casper + +COPY rootfs / + +RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/* + +EXPOSE 2368 + +VOLUME /ghost/content + +ENTRYPOINT ["startup"] +CMD ["/bin/s6-svscan", "/etc/s6.d"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..19ffcbc --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +## Dryusdan/ghost + +![](https://img.shields.io/badge/Ghost%20version-1.16.0-blue.svg) + + + +#### What is this? What features? +- A **simple** Ghost CMS build made for production. +- Based on Alpine Linux so it's lightweight! +- Bundled with latest node.js available (version check is disabled). +- Offers Isso integration. + +#### Build-time variables +- **VERSION** : version of Ghost. + +#### Environment variables +- **GID** : ghost user id *(default : 991)* +- **UID** : ghost group id *(default : 991)* +- **ADDRESS** : your domain (with *http(s)://*) *(default : https://my-ghost-blog.com)* +- **ENABLE_ISSO** : enables Isso support if set to *True* *(default : False)* +- **ISSO_HOST**, **ISSO_AVATAR**, **ISSO_VOTE** : Isso settings (*True* or *False*) + +#### Volumes +- **/ghost/content** : contents of your blog + +### Ports +- **2368** [(reverse proxy!)](https://github.com/hardware/mailserver/wiki/Reverse-proxy-configuration) + +### How to configure? +Everything you need is in `/ghost/content/ghost.conf` (also mounted on your host...). + +### docker-compose.yml sample + +``` +ghost-myblog: + image: dryusdan/ghost + container_name: ghost-myblog + environment: + - UID=8100 + - GID=8100 + - ADDRESS=https://myblog.com + volumes: + - /mnt/docker/myblog:/ghost/content +``` diff --git a/rootfs/etc/s6.d/.s6-svscan/finish b/rootfs/etc/s6.d/.s6-svscan/finish new file mode 100644 index 0000000..039e4d0 --- /dev/null +++ b/rootfs/etc/s6.d/.s6-svscan/finish @@ -0,0 +1,2 @@ +#!/bin/sh +exit 0 diff --git a/rootfs/etc/s6.d/ghost/run b/rootfs/etc/s6.d/ghost/run new file mode 100644 index 0000000..ba2c9dc --- /dev/null +++ b/rootfs/etc/s6.d/ghost/run @@ -0,0 +1,5 @@ +#!/bin/sh +cd /ghost +knex-migrator init +knex-migrator migrate +exec npm start diff --git a/rootfs/usr/local/bin/startup b/rootfs/usr/local/bin/startup new file mode 100644 index 0000000..23c06bb --- /dev/null +++ b/rootfs/usr/local/bin/startup @@ -0,0 +1,37 @@ +#!/bin/bash + +cd content +mkdir apps data images themes logs adapters &>/dev/null +rm -rf /ghost/content/themes/casper &>/dev/null +cp -r /ghost/casper themes/casper &>/dev/null +cd /ghost + +if [ ! -f /ghost/content/ghost.conf ]; then + echo + echo "INFO : No configuration file was provided, an example will be used" + echo " You can access and modify it in the volume you mounted" + echo " Restart in order to apply your changes!" + echo + mv /usr/local/etc/ghost.example.conf /ghost/content/ghost.conf +fi + +cp -f content/ghost.conf config.production.json + +sed -i -e "s|https://my-ghost-blog.com|${ADDRESS}|g" /ghost/content/ghost.conf + +if [ "$ENABLE_ISSO" == "True" ] && ! grep -q 'isso' /ghost/content/themes/casper/post.hbs; then + cd /usr/local/etc + sed -i -e "/\/author/r isso.conf" /ghost/content/themes/casper/post.hbs + sed -i -e '/isso-thread/{n;d}' /ghost/content/themes/casper/post.hbs + sed -i -e "s//$ISSO_HOST/g" \ + -e "s//$ISSO_AVATAR/g" \ + -e "s//$ISSO_VOTE/g" /ghost/content/themes/casper/post.hbs +fi + +chown -R ${UID}:${GID} /ghost /etc/s6.d + +if [ '$@' == '' ]; then + exec su-exec ${UID}:${GID} /bin/s6-svscan /etc/s6.d +else + exec su-exec ${UID}:${GID} "$@" +fi diff --git a/rootfs/usr/local/etc/disqus.conf b/rootfs/usr/local/etc/disqus.conf new file mode 100644 index 0000000..9b20532 --- /dev/null +++ b/rootfs/usr/local/etc/disqus.conf @@ -0,0 +1,16 @@ + +
+ + +comments powered by Disqus + diff --git a/rootfs/usr/local/etc/ghost.example.conf b/rootfs/usr/local/etc/ghost.example.conf new file mode 100644 index 0000000..4ef5651 --- /dev/null +++ b/rootfs/usr/local/etc/ghost.example.conf @@ -0,0 +1,12 @@ +{ + "url": "https://my-ghost-blog.com", + + "server": { + "host": "0.0.0.0", + "port": "2368" + }, + + "mail": { + "transport": "Direct" + } +} diff --git a/rootfs/usr/local/etc/isso.conf b/rootfs/usr/local/etc/isso.conf new file mode 100644 index 0000000..4287ebc --- /dev/null +++ b/rootfs/usr/local/etc/isso.conf @@ -0,0 +1,7 @@ + + + +