Created
September 21, 2021 20:43
-
-
Save kincsescsaba/2b33379581c579b2bd25b6f465cc48a8 to your computer and use it in GitHub Desktop.
Dockerized from-source Ghost CMS (experimental)
This file contains 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
# https://docs.ghost.org/faq/node-versions/ | |
# https://github.com/nodejs/Release (looking for "LTS") | |
# https://github.com/TryGhost/Ghost/blob/v4.1.2/package.json#L38 | |
FROM node:14-alpine3.13 | |
# grab su-exec for easy step-down from root | |
RUN apk add --no-cache 'su-exec>=0.2' | |
RUN apk add --no-cache git openssh python3 make; \ | |
ln -sf python3 /usr/bin/python | |
RUN apk add --no-cache --virtual .build-deps g++ gcc libc-dev make python3 vips-dev; | |
RUN apk add --no-cache \ | |
# add "bash" for "[[" | |
bash | |
#RUN set -eux; \ | |
# yarn global add knex-migrator ember-cli; | |
ENV GHOST_INSTALL /var/lib/ghost | |
ENV GHOST_CONTENT /var/lib/ghost/content | |
ENV GHOST_VERSION 4.2.1 | |
ENV GHOST_CLI_VERSION 1.16.3 | |
ENV NODE_ENV production | |
WORKDIR /root | |
COPY github.rsa . | |
RUN mkdir -p "$GHOST_INSTALL"; \ | |
chown node:node "$GHOST_INSTALL" | |
RUN chmod 400 github.rsa ; \ | |
eval $(ssh-agent) ; \ | |
ssh-add github.rsa ; \ | |
ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts ; \ | |
git clone --recursive --depth 1 --branch v$GHOST_VERSION git@github.com:kincsescsaba/GhostCustom.git $GHOST_INSTALL | |
WORKDIR $GHOST_INSTALL | |
RUN sqlite3Version="$(node -p 'require("./package.json").optionalDependencies.sqlite3')"; \ | |
if ! su-exec node npm install "sqlite3@$sqlite3Version"; then \ | |
npm_config_python='python3' su-exec node npm install "sqlite3@$sqlite3Version"; \ | |
fi | |
RUN chmod -R 777 /usr/local/lib/node_modules ; \ | |
chmod -R 777 /usr/local/bin ; \ | |
chmod -R 777 $GHOST_INSTALL ; \ | |
rm config.development.json ; \ | |
ln -s core/shared/config/env/config.development.json config.development.json ; \ | |
ln -s core/shared/config/env/config.development.json config.production.json | |
RUN su-exec node npm install -g matchdep knex-migrator ember-cli ; \ | |
su-exec node npm install -g grunt ; \ | |
su-exec node npm install --dev ; \ | |
su-exec node grunt knex-migrator ; \ | |
su-exec node grunt symlink ; \ | |
su-exec node grunt init ; \ | |
su-exec DEBUG=ghost:* ; \ | |
su-exec node npm cache clean --force; \ | |
npm cache clean --force | |
COPY docker-entrypoint.sh /usr/local/bin | |
ENTRYPOINT ["docker-entrypoint.sh"] | |
EXPOSE 2368 | |
CMD ["node", "index.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment