Created
November 9, 2017 04:39
-
-
Save pascalandy/234bf979639428f5afd9ff80dce196f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Builder layer | |
# | |
FROM node:6-alpine as ghost-builder | |
RUN npm install --loglevel=error -g ghost-cli | |
ENV GHOST_VERSION 1.17.0 | |
ENV GHOST_INSTALL /var/lib/ghost | |
ENV GHOST_CONTENT /var/lib/ghost/content | |
ENV GHOST_USER node | |
WORKDIR $GHOST_INSTALL | |
# Run SQLite as database | |
RUN \ | |
ghost install "$GHOST_VERSION" --db sqlite3 --no-prompt --no-stack --no-setup --dir "$GHOST_INSTALL"; \ | |
ghost config --ip 0.0.0.0 --port 2368 --no-prompt --db sqlite3 --url http://localhost:2368 --dbpath "$GHOST_CONTENT/data/ghost.db"; \ | |
ghost config paths.contentPath "$GHOST_CONTENT"; | |
COPY run-ghost.sh $GHOST_INSTALL | |
# | |
# Final image | |
# | |
FROM node:6-alpine | |
LABEL maintainer="Marco Mornati <[email protected]>" | |
ENV GHOST_VERSION 1.17.0 | |
ENV GHOST_INSTALL /var/lib/ghost | |
ENV GHOST_CONTENT /var/lib/ghost/content | |
ENV GHOST_USER node | |
# Install Ghost | |
COPY --from=ghost-builder --chown=node $GHOST_INSTALL $GHOST_INSTALL | |
USER $GHOST_USER | |
ENV HOME $GHOST_INSTALL | |
ENV PATH="${GHOST_INSTALL}/current/node_modules/knex-migrator/bin:${PATH}" | |
# Keeping Original GhostContent to be copied into the mounted volume (if empty) | |
RUN cp -r "$GHOST_CONTENT" "$GHOST_INSTALL/content.bck"; | |
# Define working directory | |
WORKDIR $GHOST_INSTALL | |
# Set environment variables | |
ENV NODE_ENV production | |
# Expose ports | |
EXPOSE 2368 | |
# HealthCheck | |
#HEALTHCHECK --interval=5m --timeout=3s \ | |
# CMD echo "GET / HTTP/1.1" | nc -v localhost 2368 || exit 1 | |
# Define mountable directories | |
VOLUME [ "${GHOST_CONTENT}" ] | |
# Define default command | |
CMD [ "/bin/sh", "-c", "/bin/sh ${GHOST_INSTALL}/run-ghost.sh" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment