added user and group id mapping
This commit is contained in:
parent
99def1dad5
commit
55b15f7fbd
20
Dockerfile
20
Dockerfile
|
@ -7,10 +7,8 @@ LABEL Description="This image is used to learn building dockerfiles" \
|
|||
|
||||
# environment variables
|
||||
ENV JEKYLL_SITE=default
|
||||
|
||||
# copy stuff into the image
|
||||
COPY jekyll.sh jekyll.sh
|
||||
RUN chmod +x jekyll.sh
|
||||
ENV USER_ID=1000
|
||||
ENV GROUP_ID=1000
|
||||
|
||||
# expose port for `jekyll serve`
|
||||
EXPOSE 4000
|
||||
|
@ -18,9 +16,17 @@ EXPOSE 4000
|
|||
# volume definitions
|
||||
VOLUME ["/mnt"]
|
||||
|
||||
# prepare the baseimage
|
||||
# prepare the baseimage and create
|
||||
RUN apt-get update && apt-get install -y ruby ruby-dev gcc g++ make libssl-dev libreadline-dev && \
|
||||
gem update && gem install jekyll bundler
|
||||
gem update && gem install jekyll bundler && \
|
||||
groupadd -g $GROUP_ID jekyll-dev && \
|
||||
useradd -u $USER_ID -g $GROUP_ID -M -d /mnt -s /bin/false jekyll-dev
|
||||
|
||||
USER jekyll-dev
|
||||
|
||||
RUN cd /mnt && \
|
||||
if [ ! -d "/mnt/$JEKYLL_SITE" ]; then jekyll new $JEKYLL_SITE; fi && \
|
||||
cd $JEKYLL_SITE && bundle install
|
||||
|
||||
# run command
|
||||
CMD ./jekyll.sh
|
||||
CMD bundle exec jekyll serve --host=0.0.0.0 --incremental
|
|
@ -11,3 +11,5 @@ services:
|
|||
- 127.0.0.1:4000:4000
|
||||
environment:
|
||||
- JEKYLL_SITE=docs
|
||||
- USER_ID=1000
|
||||
- GROUP_ID=1000
|
Reference in New Issue