Skip to content

Commit 9fd3942

Browse files
committed
Merge branch 'master' of github.com:firepress-org/ghostfire
2 parents fdf7f27 + f4a1927 commit 9fd3942

File tree

1 file changed

+50
-43
lines changed

1 file changed

+50
-43
lines changed

Dockerfile

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
###################################
77

88
ARG APP_NAME="ghostfire"
9-
ARG VERSION="3.38.3"
10-
ARG RELEASE="3.38.3"
9+
ARG VERSION="3.36.0"
10+
ARG RELEASE="3.36.0"
1111
ARG GITHUB_USER="firepress-org"
1212

1313
###################################
@@ -26,10 +26,10 @@ ARG GIT_REPO_SOURCE="https://github.com/TryGhost/Ghost"
2626
# Start your Dockerfile from here
2727
###################################
2828
ARG OS="alpine"
29-
ARG NODE_VERSION="14.15.0-alpine3.12"
29+
ARG NODE_VERSION="12.18.4-alpine3.12"
3030
# node version issue: https://github.com/docker-library/ghost/issues/208
3131
# https://hub.docker.com/_/node/
32-
ARG GHOST_CLI_VERSION="1.15.2"
32+
ARG GHOST_CLI_VERSION="1.14.1"
3333
ARG ALPINE_VERSION="3.12"
3434
ARG USER="node"
3535
ARG GHOST_USER="node"
@@ -58,7 +58,7 @@ FROM myalpine AS app-version-debug
5858
# grab su-exec for easy step-down from root
5959
# add "bash" for "[["
6060
RUN set -eux && apk update && apk add --no-cache \
61-
'su-exec>=0.2' bash upx curl tini tzdata &&\
61+
'su-exec>=0.2' bash upx curl tini tzdata && \
6262
apk upgrade
6363

6464
# ----------------------------------------------
@@ -69,10 +69,10 @@ RUN set -eux && apk update && apk add --no-cache \
6969
# ----------------------------------------------
7070
FROM myalpine AS node-compress
7171
COPY --from=mynode /usr/local/bin/node /usr/local/bin/node
72-
RUN set -eux &&\
72+
RUN set -eux && \
7373
apk --update add --no-cache \
74-
upx="3.96-r0" &&\
75-
upx /usr/local/bin/node &&\
74+
upx="3.96-r0" && \
75+
upx /usr/local/bin/node && \
7676
upx -t /usr/local/bin/node ;
7777

7878
# ----------------------------------------------
@@ -84,8 +84,8 @@ ARG GHOST_USER
8484
ENV GHOST_USER="${GHOST_USER}"
8585

8686
# set up node user and group
87-
RUN set -eux &&\
88-
addgroup -g 1000 "${GHOST_USER}" &&\
87+
RUN set -eux && \
88+
addgroup -g 1000 "${GHOST_USER}" && \
8989
adduser -u 1000 -G "${GHOST_USER}" -s /bin/sh -D node ;
9090

9191
COPY --from=node-compress --chown=node:node /usr/local/bin/node /usr/bin/
@@ -173,67 +173,74 @@ ENV GHOST_INSTALL="/var/lib/ghost" \
173173
RUN set -eux && apk --update add --no-cache \
174174
su-exec>="0.2" \
175175
bash \
176-
ca-certificates &&\
177-
update-ca-certificates &&\
178-
rm -rvf /var/cache/apk/* &&\
176+
ca-certificates && \
177+
update-ca-certificates && \
178+
rm -rvf /var/cache/apk/* && \
179179
\
180180
# install Ghost CLI
181-
npm install --production -g "ghost-cli@${GHOST_CLI_VERSION}" &&\
182-
npm cache clean --force &&\
181+
npm install --production -g "ghost-cli@${GHOST_CLI_VERSION}" && \
182+
npm cache clean --force && \
183183
\
184-
mkdir -p "${GHOST_INSTALL}" &&\
185-
chown -R "${GHOST_USER}":"${GHOST_USER}" "${GHOST_INSTALL}" &&\
184+
mkdir -p "${GHOST_INSTALL}" && \
185+
chown -R "${GHOST_USER}":"${GHOST_USER}" "${GHOST_INSTALL}" && \
186186
\
187187
# install Ghost / optional: --verbose
188188
su-exec node ghost install "${VERSION}" \
189189
--db sqlite3 --no-prompt --no-stack \
190-
--no-setup --dir "${GHOST_INSTALL}" &&\
190+
--no-setup --dir "${GHOST_INSTALL}" && \
191191
\
192192
# tell Ghost to listen on all IPs and not prompt for additional configuration
193-
cd "${GHOST_INSTALL}" &&\
193+
cd "${GHOST_INSTALL}" && \
194194
su-exec node ghost config --ip 0.0.0.0 \
195195
--port 2368 --no-prompt --db sqlite3 \
196196
--url http://localhost:2368 \
197-
--dbpath "${GHOST_CONTENT}/data/ghost.db" &&\
197+
--dbpath "${GHOST_CONTENT}/data/ghost.db" && \
198198
su-exec node ghost config \
199-
paths.contentPath "${GHOST_CONTENT}" &&\
199+
paths.contentPath "${GHOST_CONTENT}" && \
200200
\
201201
# make a config.json symlink for NODE_ENV=development (and sanity check that it's correct)
202202
su-exec node ln -s config.production.json \
203-
"${GHOST_INSTALL}/config.development.json" &&\
204-
readlink -f "${GHOST_INSTALL}/config.development.json" &&\
203+
"${GHOST_INSTALL}/config.development.json" && \
204+
readlink -f "${GHOST_INSTALL}/config.development.json" && \
205205
\
206206
# need to save initial content for pre-seeding empty volumes
207-
mv "${GHOST_CONTENT}" "${GHOST_INSTALL}/content.orig" &&\
208-
mkdir -p "${GHOST_CONTENT}" &&\
209-
chown -R "${GHOST_USER}":"${GHOST_USER}" "$GHOST_CONTENT" &&\
207+
mv "${GHOST_CONTENT}" "${GHOST_INSTALL}/content.orig" && \
208+
mkdir -p "${GHOST_CONTENT}" && \
209+
chown -R "${GHOST_USER}":"${GHOST_USER}" "$GHOST_CONTENT" && \
210210
\
211211
# sanity check to ensure knex-migrator was installed
212-
"${GHOST_INSTALL}/current/node_modules/knex-migrator/bin/knex-migrator" --version &&\
212+
"${GHOST_INSTALL}/current/node_modules/knex-migrator/bin/knex-migrator" --version && \
213213
# sanity check to list all packages
214214
npm config list ;
215215

216216
# force install "sqlite3" manually since it's an optional dependency of "ghost"
217217
# (which means that if it fails to install, like on ARM/ppc64le/s390x, the failure will be silently ignored and thus turn into a runtime error instead)
218218
# see https://github.com/TryGhost/Ghost/pull/7677 for more details
219-
RUN set -eux &&\
220-
cd "${GHOST_INSTALL}/current" &&\
219+
RUN set -eux && \
220+
cd "${GHOST_INSTALL}/current" && \
221221
# scrape the expected version of sqlite3 directly from Ghost itself
222-
sqlite3Version="$(node -p 'require("./package.json").optionalDependencies.sqlite3')" &&\
223-
\
224-
if ! su-exec node yarn add "sqlite3@$sqlite3Version" --force; then \
222+
sqlite3Version="$(node -p 'require("./package.json").optionalDependencies.sqlite3')" && \
223+
\
224+
if ! su-exec node yarn add \
225+
"sqlite3@$sqlite3Version" --force; then \
225226
# must be some non-amd64 architecture pre-built binaries aren't published for, so let's install some build deps and do-it-all-over-again
226-
apk add --no-cache --virtual .build-deps g++ \
227-
gcc libc-dev make python3 vips-dev &&\
228-
npm_config_python='python3' su-exec node \
229-
yarn add "sqlite3@$sqlite3Version" --force \
230-
--build-from-source && apk del --no-network .build-deps ; \
231-
fi &&\
232-
\
233-
su-exec node yarn cache clean &&\
234-
su-exec node npm cache clean --force &&\
235-
npm cache clean --force &&\
236-
rm -rv /tmp/yarn* /tmp/v8* ;
227+
apk add --no-cache --virtual \
228+
.build-deps \
229+
python \
230+
make \
231+
gcc \
232+
g++ \
233+
libc-dev && \
234+
\
235+
su-exec node yarn add "sqlite3@$sqlite3Version" \
236+
--force --build-from-source && \
237+
\
238+
apk del --no-network .build-deps ; \
239+
fi && \
240+
su-exec node yarn cache clean && \
241+
su-exec node npm cache clean --force && \
242+
npm cache clean --force && \
243+
rm -rv /tmp/yarn* /tmp/v8* ;
237244

238245
# ----------------------------------------------
239246
# 7) LAYER final

0 commit comments

Comments
 (0)