Skip to content

Commit

Permalink
Run image as "ghost"
Browse files Browse the repository at this point in the history
- Faster start: chown ghost sources in docker layer
- Create /ghost-override volume directory in layer
- Remove unused cd (WORKDIR is already /ghost)

Signed-off-by: Vincent Giersch <[email protected]>
  • Loading branch information
gierschv committed Oct 16, 2014
1 parent d6b82d8 commit c85f689
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ RUN \
cd /ghost && \
npm install --production && \
sed 's/127.0.0.1/0.0.0.0/' /ghost/config.example.js > /ghost/config.js && \
useradd ghost --home /ghost
mkdir /ghost-override && \
useradd ghost --home /ghost && \
chown -R ghost:ghost /ghost /ghost-override /data

# Add files.
ADD start.bash /ghost-start
Expand All @@ -33,5 +35,8 @@ WORKDIR /ghost
# Define default command.
CMD ["bash", "/ghost-start"]

# Run as ghost
USER ghost

# Expose ports.
EXPOSE 2368
6 changes: 0 additions & 6 deletions start.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ DATA="content/data"
IMAGES="content/images"
THEMES="content/themes"

cd "$GHOST"

# Symlink data directory.
mkdir -p "$OVERRIDE/$DATA"
rm -fr "$DATA"
Expand All @@ -36,8 +34,4 @@ if [[ -d "$OVERRIDE/$THEMES" ]]; then
fi

# Start Ghost
chown -R ghost:ghost /data /ghost /ghost-override
su ghost << EOF
cd "$GHOST"
NODE_ENV=${NODE_ENV:-production} npm start
EOF

0 comments on commit c85f689

Please sign in to comment.