Skip to content

Instantly share code, notes, and snippets.

@djmaze
Last active December 27, 2015 05:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djmaze/7272672 to your computer and use it in GitHub Desktop.
Save djmaze/7272672 to your computer and use it in GitHub Desktop.
Dockerfile for Ghost (production installation)
# Install Ghost blogging platform and run in production environment on port 2368.
#
# 1. Clone https://github.com/TryGhost/Ghost.git and put this file into the project root directory.
# 2. Replace www.example.com (down below) with the FQDN the blog is supposed to run on.
# 3. Build with:
# sudo docker build -t ghost .
# 4. Create local data directory:
# mkdir -p ~/.docker_volumes/ghost/data
#
# Run it with:
# sudo docker run -d -p 2368:2368 -v ~/.docker_volumes/ghost/data:/data/ghost/content/data ghost
FROM ubuntu:12.10
WORKDIR /data/ghost
# Install dependencies for nginx installation
RUN apt-get install -y python g++ make software-properties-common
RUN add-apt-repository ppa:chris-lea/node.js
RUN apt-get update
# Install nodejs & npm
RUN apt-get install -y rlwrap
RUN apt-get install -y nodejs
RUN curl https://npmjs.org/install.sh | sh
# Install dependencies for sass compiling
RUN apt-get install -y ruby
RUN gem install sass bourbon --no-ri --no-rdoc
# Add Ghost to image
ADD . /data/ghost
# Install Ghost with NPM
RUN npm install -g grunt-cli && npm install
# HOTFIX, see https://github.com/TryGhost/Ghost/pull/1174
#RUN echo '@charset "utf-8";' | cat - /data/ghost/core/client/assets/sass/layouts/errors.scss >/tmp/out && mv /tmp/out /data/ghost/core/client/assets/sass/layouts/errors.scss
RUN grunt init prod
# Add custom config js to /data/ghost
ADD ./config.example.js /data/ghost/config.js
# Adjust config
RUN sed -i 's/http:\/\/my-ghost-blog.com/http:\/\/www.example.com/; s/127.0.0.1/0.0.0.0/' config.js
# Run Ghost
ENV NODE_ENV production
CMD ["npm", "start"]
# Expose port 2368
EXPOSE 2368
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment