Skip to content

Add custom uid gid #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# https://github.com/nodejs/LTS
FROM node:4-slim

RUN groupadd user && useradd --create-home --home-dir /home/user -g user user

# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.7
RUN set -x \
Expand Down Expand Up @@ -38,7 +36,7 @@ RUN buildDeps=' \
&& rm -rf /tmp/npm*

ENV GHOST_CONTENT /var/lib/ghost
RUN mkdir -p "$GHOST_CONTENT" && chown -R user:user "$GHOST_CONTENT"
RUN mkdir -p "$GHOST_CONTENT"
VOLUME $GHOST_CONTENT

COPY docker-entrypoint.sh /entrypoint.sh
Expand Down
7 changes: 6 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ if [[ "$*" == npm*start* ]]; then

ln -sf "$GHOST_CONTENT/config.js" "$GHOST_SOURCE/config.js"

chown -R user "$GHOST_CONTENT"
PUID=${PUID:-1001}
PGID=${PGID:-1001}
groupadd -o -g "$PGID" user
useradd --create-home --home-dir /home/user -g user -o -u "$PUID" user

chown -R user:user "$GHOST_CONTENT"

set -- gosu user "$@"
fi
Expand Down