david/jekyll-dev
david
/
jekyll-dev
Archived
1
0
Fork 0
This repository has been archived on 2023-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
jekyll-dev/Dockerfile

32 lines
937 B
Docker

# Dockerfile to build and serve a jekyll site with the development webserver
FROM ubuntu:focal
LABEL Description="This image is used to learn building dockerfiles" \
Author="david@socialnerds.org" \
Version="0.1" \
License="MIT"
# environment variables
ENV JEKYLL_SITE=default
ENV USER_ID=1000
ENV GROUP_ID=1000
# expose port for `jekyll serve`
EXPOSE 4000
# volume definitions
VOLUME ["/mnt"]
# 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 && \
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 bundle exec jekyll serve --host=0.0.0.0 --incremental