ghost: add 1.x

This commit is contained in:
Wonderfall 2017-07-20 17:41:14 +02:00
parent 5d56ebbd79
commit 15e04fdfa2
19 changed files with 151 additions and 1 deletions

View File

@ -1,6 +1,6 @@
FROM alpine:3.6
ARG GHOST_VERSION=0.11.10
ARG GHOST_VERSION=0.11.11
ENV GHOST_NODE_VERSION_CHECK=false \
GID=991 \

45
ghost/1.x/Dockerfile Normal file
View File

@ -0,0 +1,45 @@
FROM alpine:3.6
ARG VERSION=1.0.0-rc.1
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 \
ENABLE_DISQUS=False \
DISQUS_SHORTNAME=shortname
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 \
&& 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
LABEL description="Ghost CMS ${VERSION}" \
maintainer="Wonderfall <wonderfall@targaryen.house>"
ENTRYPOINT ["run.sh"]
CMD ["/bin/s6-svscan", "/etc/s6.d"]

View File

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

View File

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

View File

@ -0,0 +1,54 @@
#!/bin/bash
echo
echo ">>> wonderfall/ghost container <<<"
echo
echo "> Initializing content folder..."
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/config.production.json ]; 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
ln -s content/ghost.conf config.production.json
fi
echo "> Applying preferences..."
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
if [ "$ENABLE_DISQUS" == "True" ] && grep -q 'Disqus comments' /ghost/content/themes/casper/post.hbs; then
### This is crap, if you have a better idea, tell me!
vim -e - /ghost/content/themes/casper/post.hbs <<@@@
g/site-id/.-5,.d
wq
@@@
sed -i '87d' /ghost/content/themes/casper/post.hbs
sed -i -e "s/test-apkdzgmqhj/${DISQUS_SHORTNAME}/g" /ghost/content/themes/casper/post.hbs
fi
echo "> Updating permissions..."
chown -R ${UID}:${GID} /ghost /etc/s6.d
echo "> Executing process..."
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,21 @@
{
"url": "https://my-ghost-blog.com",
"server": {
"host": "0.0.0.0",
"port": "2368"
},
"database": {
"client": "sqlite3",
"connection": {
"filename": "content/data/ghost-dev.db"
},
"useNullAsDefault": true,
"debug": false
},
"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>