Docker image for updating site
This commit is contained in:
parent
422462ec6e
commit
3686d1c9d7
4 changed files with 63 additions and 0 deletions
19
Dockerfile-siteupdate
Normal file
19
Dockerfile-siteupdate
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
FROM ruby:2-bullseye
|
||||||
|
COPY Gemfile* /tmp/
|
||||||
|
RUN cd /tmp && bundle install && rm Gemfile*
|
||||||
|
RUN apt-get update && apt-get install -y rsync git && rm -rf /var/lib/apt/lists/*
|
||||||
|
COPY scripts/update-site.sh /usr/local/bin/
|
||||||
|
|
||||||
|
# Home directory of user, containing ssh keys, etc.
|
||||||
|
VOLUME /data
|
||||||
|
# Website source
|
||||||
|
ENV WEBSITE_SOURCE=/website-source
|
||||||
|
VOLUME /website-source
|
||||||
|
# Compiled website
|
||||||
|
VOLUME /website
|
||||||
|
|
||||||
|
RUN useradd -M -d /data siteupdate && chown siteupdate:siteupdate /data /website-source /website
|
||||||
|
USER siteupdate:siteupdate
|
||||||
|
WORKDIR /data
|
||||||
|
CMD /usr/local/bin/update-site.sh
|
||||||
|
|
||||||
|
|
@ -109,4 +109,8 @@ deploy:
|
||||||
kind: rsync
|
kind: rsync
|
||||||
dst: "/var/www/www.cccs.de/htdocs"
|
dst: "/var/www/www.cccs.de/htdocs"
|
||||||
options: [ '-rlPq', '--delete-after' ]
|
options: [ '-rlPq', '--delete-after' ]
|
||||||
|
incontainer:
|
||||||
|
kind: rsync
|
||||||
|
dst: "/website"
|
||||||
|
options: [ '-rlPq', '--delete-after' ]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,5 @@ set -u -e
|
||||||
cd `dirname $0`/..
|
cd `dirname $0`/..
|
||||||
|
|
||||||
docker build -f Dockerfile-reminders -t cccs-reminders:latest .
|
docker build -f Dockerfile-reminders -t cccs-reminders:latest .
|
||||||
|
docker build -f Dockerfile-siteupdate -t cccs-siteupdate:latest .
|
||||||
|
|
||||||
|
|
|
||||||
39
scripts/update-site.sh
Executable file
39
scripts/update-site.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DEPLOY_TARGET="${1:-incontainer}"
|
||||||
|
if [[ "$WEBSITE_SOURCE" == "" ]] ; then
|
||||||
|
WEBSITE_SOURCE=`dirname $0`/..
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update site
|
||||||
|
cd $WEBSITE_SOURCE
|
||||||
|
if [[ -d .git ]] ; then
|
||||||
|
git pull || exit 1
|
||||||
|
else
|
||||||
|
git clone git@github.com:cccs/cccs-website.git . || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update Twitter
|
||||||
|
cd $WEBSITE_SOURCE/content/_data
|
||||||
|
../../scripts/update-twitter.sh
|
||||||
|
git add twitter.csv
|
||||||
|
git commit -m "Update Twitter"
|
||||||
|
|
||||||
|
# Update blog roll
|
||||||
|
cd $WEBSITE_SOURCE/scripts
|
||||||
|
./update-planetfeeds.rb ../content/_data/planetcccs-blogroll.yaml ../content/planet-cccs.yaml
|
||||||
|
git add ../content/planet-cccs.yaml
|
||||||
|
git commit -m "Update Planet"
|
||||||
|
|
||||||
|
# Push changes
|
||||||
|
cd $WEBSITE_SOURCE
|
||||||
|
git push
|
||||||
|
|
||||||
|
# Update site
|
||||||
|
rm -rf tmp output
|
||||||
|
#bundle exec nanoc || exit 1
|
||||||
|
bundle exec nanoc
|
||||||
|
rm -f crash.log
|
||||||
|
umask 0002
|
||||||
|
bundle exec nanoc deploy -t "$DEPLOY_TARGET"
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue