File tree 2 files changed +14
-12
lines changed
2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 2
2
# https://github.com/nodejs/LTS
3
3
FROM node:4-slim
4
4
5
+ RUN groupadd user && useradd --create-home --home-dir /home/user -g user user
6
+
5
7
# grab gosu for easy step-down from root
6
8
ENV GOSU_VERSION 1.7
7
9
RUN set -x \
@@ -36,7 +38,12 @@ RUN buildDeps=' \
36
38
&& rm -rf /tmp/npm*
37
39
38
40
ENV GHOST_CONTENT /var/lib/ghost
39
- RUN mkdir -p "$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"
40
47
VOLUME $GHOST_CONTENT
41
48
42
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,17 +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
- PUID=${PUID:- 1001}
24
- PGID=${PGID:- 1001}
25
- groupadd -o -g " $PGID " user
26
- useradd --create-home --home-dir /home/user -g user -o -u " $PUID " user
27
-
28
- chown -R user:user " $GHOST_CONTENT "
29
-
30
- set -- gosu user " $@ "
31
26
fi
32
27
33
28
exec " $@ "
You can’t perform that action at this time.
0 commit comments