Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.


5 changes: 4 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config = {
database: {
client: 'sqlite3',
connection: {
filename: '/data/ghost.db'
filename: 'content/data/ghost.db'
},
debug: false
},
Expand All @@ -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')
}
}
};
Expand Down
13 changes: 11 additions & 2 deletions run
Original file line number Diff line number Diff line change
@@ -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