File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,12 @@ RUN buildDeps=' \
38
38
&& rm -rf /tmp/npm*
39
39
40
40
ENV GHOST_CONTENT /var/lib/ghost
41
- RUN mkdir -p "$GHOST_CONTENT" && chown -R user:user "$GHOST_CONTENT"
41
+ RUN mkdir -p "$GHOST_CONTENT" \
42
+ && chown -R user:user "$GHOST_CONTENT" \
43
+ # Ghost expects "config.js" to be in $GHOST_SOURCE, but it's more useful for
44
+ # image users to manage that as part of their $GHOST_CONTENT volume, so we
45
+ # symlink.
46
+ && ln -s "$GHOST_CONTENT/config.js" "$GHOST_SOURCE/config.js"
42
47
VOLUME $GHOST_CONTENT
43
48
44
49
COPY docker-entrypoint.sh /entrypoint.sh
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
set -e
3
3
4
+ # allow the container to be started with `--user`
5
+ if [[ " $* " == npm* start* ]] && [ " $( id -u) " = ' 0' ]; then
6
+ chown -R user " $GHOST_CONTENT "
7
+ exec gosu user " $BASH_SOURCE " " $@ "
8
+ fi
9
+
4
10
if [[ " $* " == npm* start* ]]; then
5
11
baseDir=" $GHOST_SOURCE /content"
6
12
for dir in " $baseDir " /* / " $baseDir " /themes/* /; do
@@ -17,12 +23,6 @@ if [[ "$*" == npm*start* ]]; then
17
23
s!path.join\(__dirname, (.)/content!path.join(process.env.GHOST_CONTENT, \1!g;
18
24
' " $GHOST_SOURCE /config.example.js" > " $GHOST_CONTENT /config.js"
19
25
fi
20
-
21
- ln -sf " $GHOST_CONTENT /config.js" " $GHOST_SOURCE /config.js"
22
-
23
- chown -R user " $GHOST_CONTENT "
24
-
25
- set -- gosu user " $@ "
26
26
fi
27
27
28
28
exec " $@ "
You can’t perform that action at this time.
0 commit comments