diff --git a/Dockerfile b/Dockerfile index b74691e..32a9661 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,21 +5,30 @@ RUN apt-get update -qq && apt-get install -qy python-software-properties RUN add-apt-repository ppa:chris-lea/node.js RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list RUN apt-get -qq update && apt-get install -qy sudo curl unzip nodejs -RUN curl -L https://en.ghost.org/zip/ghost-0.5.0.zip > /tmp/ghost.zip +RUN curl -L https://en.ghost.org/zip/ghost-0.5.3.zip > /tmp/ghost.zip RUN useradd ghost RUN mkdir -p /opt/ghost -WORKDIR /opt/ghost +RUN mkdir -p /opt/ghost-temp +WORKDIR /opt/ghost-temp RUN unzip /tmp/ghost.zip RUN npm install --production # Volumes -RUN mkdir /data -VOLUME ["/data"] +# RUN mkdir /data +# VOLUME ["/data"] + + +# RUN mkdir /ghostcontent +# VOLUME ["/ghostcontent"] + +VOLUME ["/opt/ghost"] ADD run /usr/local/bin/run -ADD config.js /opt/ghost/config.js +ADD config.js /opt/ghost-temp/config.js RUN chown -R ghost:ghost /opt/ghost +WORKDIR /opt/ghost + ENV NODE_ENV production ENV GHOST_URL http://my-ghost-blog.com EXPOSE 2368 diff --git a/README.md b/README.md index 565605d..a6311c4 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ docker-ghost ============ +Build from this repository +-------------------------- + $ git clone https://github.com/atroo/docker-ghost.git + $ cd docker-ghost + $ docker build -t="docker-ghost" . + + Run [Ghost](http://ghost.org) with Docker: - $ docker run -d -p 2368:2368 -e GHOST_URL=http://my-ghost-blog.com orchardup/ghost + $ docker run -d -p 2368:2368 --name ghost \ + -e GHOST_URL=http://www.atroo.de \ + -v /opt/ghost/content:/ghostcontent \ + -v /opt/ghost/data:/data \ + docker-ghost -Your Ghost blog will be running on [http://127.0.0.1:2368](http://127.0.0.1:2368). +Your Ghost blog will be running on [http://127.0.0.1:2368](http://127.0.0.1:2368). And the database will be persisted to /opt/ghost/data while the uploaded content and your themes are going to reside in /opt/ghost/content. Those two directory can be configured at will, just map them to /ghostcontent and /data . Running on Orchard @@ -26,9 +37,3 @@ This image can be configured with environment variables: - `GHOST_URL`: The url to use when providing links to the site, E.g. in RSS and email. -Caveats -------- - -You will lose your uploads if you upgrade Ghost by replacing the image. This is because there is no way of specifying an upload directory for Ghost yet, but [they're working on it](https://github.com/TryGhost/Ghost/issues/635). The database is saved in a volume called `/data` so it will persist just fine. - - diff --git a/config.js b/config.js index 102873a..7e05c69 100644 --- a/config.js +++ b/config.js @@ -14,7 +14,7 @@ config = { database: { client: 'sqlite3', connection: { - filename: '/data/ghost.db' + filename: 'content/data/ghost.db' }, debug: false }, @@ -23,6 +23,9 @@ config = { host: '0.0.0.0', // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT` port: '2368' + }, + paths: { + contentPath: path.join('content') } } }; diff --git a/run b/run index 4604568..b694802 100755 --- a/run +++ b/run @@ -1,5 +1,14 @@ #!/bin/bash -set -e -chown -R ghost:ghost /data +# cp /opt/ghost/content/* /ghostcontent -rf + +if [ -d /opt/ghost-temp ]; then + cp /opt/ghost-temp/* /opt/ghost -rf + rm -rf /opt/ghost-temp +fi +# rm -rf /opt/ghost/content +# set -e +# chown -R ghost:ghost /data +# chown -R ghost:ghost /ghostcontent +chown -R ghost:ghost /opt/ghost exec sudo -E -u ghost npm start