first commit

This commit is contained in:
root 2017-11-03 19:33:40 +00:00
commit 6c5ec13aa1
8 changed files with 164 additions and 0 deletions

41
Dockerfile Normal file
View File

@ -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"]

44
README.md Normal file
View File

@ -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
```

View File

@ -0,0 +1,2 @@
#!/bin/sh
exit 0

View File

@ -0,0 +1,5 @@
#!/bin/sh
cd /ghost
knex-migrator init
knex-migrator migrate
exec npm start

View File

@ -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/<HOST>/$ISSO_HOST/g" \
-e "s/<AVATAR>/$ISSO_AVATAR/g" \
-e "s/<VOTE>/$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

View File

@ -0,0 +1,16 @@
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = '<SHORTNAME>';
var disqus_identifier = '{{post.id}}';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

View File

@ -0,0 +1,12 @@
{
"url": "https://my-ghost-blog.com",
"server": {
"host": "0.0.0.0",
"port": "2368"
},
"mail": {
"transport": "Direct"
}
}

View File

@ -0,0 +1,7 @@
</footer>
<script data-isso="//<HOST>/"
data-isso-avatar="<AVATAR>"
data-isso-vote="<VOTE>"
src="//<HOST>/js/embed.min.js"></script>
<section id="isso-thread"></section>