updated container
This commit is contained in:
parent
03a8361d54
commit
d8539c22bf
11
Dockerfile
11
Dockerfile
|
@ -1,12 +1,11 @@
|
|||
# Dockerfile to build and serve a jekyll site with the development webserver
|
||||
FROM ubuntu:focal
|
||||
LABEL Description="This image is used build and serve jekyll sites" \
|
||||
LABEL Description="This image is used for developing Jekyll sites." \
|
||||
Author="david@socialnerds.org" \
|
||||
Version="0.1" \
|
||||
License="MIT"
|
||||
|
||||
# environment variables
|
||||
ENV JEKYLL_SITE=default
|
||||
ENV USER_ID=1000
|
||||
ENV GROUP_ID=1000
|
||||
ENV USERNAME=jekyll-dev
|
||||
|
@ -18,16 +17,16 @@ EXPOSE 4000
|
|||
VOLUME ["/mnt"]
|
||||
|
||||
# prepare the baseimage
|
||||
RUN apt-get update && apt-get install -y ruby ruby-dev gcc g++ make libssl-dev libreadline-dev && \
|
||||
RUN apt-get update && apt-get install -y ruby ruby-dev gcc g++ make libssl-dev libreadline-dev python3 && \
|
||||
gem update && gem install jekyll bundler && \
|
||||
groupadd -g $GROUP_ID $USERNAME && \
|
||||
useradd -u $USER_ID -g $GROUP_ID -m -d /home/$USERNAME -s /bin/false $USERNAME
|
||||
|
||||
# copy jekyll script into the image
|
||||
COPY jekyll.sh /opt/jekyll.sh
|
||||
# set working directory
|
||||
WORKDIR /mnt
|
||||
|
||||
# set executing user name
|
||||
USER $USERNAME
|
||||
|
||||
# run jekyll script
|
||||
CMD bash /opt/jekyll.sh
|
||||
CMD python3 -m http.server -d _site 4000
|
34
README.md
34
README.md
|
@ -1,35 +1,3 @@
|
|||
# jekyll-dev
|
||||
|
||||
Simple container to build and serve a jekyll site.
|
||||
|
||||
## Use
|
||||
|
||||
```bash
|
||||
# clone repository
|
||||
git clone https://socialg.it/david/jekyll-dev.git
|
||||
cd jekyll-dev
|
||||
|
||||
# edit to your needs
|
||||
vim docker-compose.yml
|
||||
|
||||
# build and run container
|
||||
docker-compose build
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Update
|
||||
|
||||
```bash
|
||||
cd jekyll-dev
|
||||
docker-compose pull && docker-compose build
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Remove
|
||||
|
||||
```bash
|
||||
cd jekyll-dev
|
||||
docker-compose down
|
||||
cd ..
|
||||
rm -rf jekyll-dev
|
||||
```
|
||||
Simple container to help develop Jekyll sites.
|
|
@ -6,10 +6,6 @@ services:
|
|||
build: .
|
||||
container_name: jekyll-dev
|
||||
volumes:
|
||||
- /home/david/Projects/just-the-docs:/mnt
|
||||
- /home/david/Projects/just-the-docs/docs:/mnt
|
||||
ports:
|
||||
- 127.0.0.1:4000:4000
|
||||
environment:
|
||||
- JEKYLL_SITE=docs
|
||||
- USER_ID=1000
|
||||
- GROUP_ID=1000
|
||||
- 127.0.0.1:4000:4000
|
15
jekyll.sh
15
jekyll.sh
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# set $PATH
|
||||
export PATH=$PATH:$HOME/.gem/bin
|
||||
|
||||
# create new jekyll site if the destination directory it does not exist
|
||||
if [ ! -d "/mnt/$JEKYLL_SITE" ]; then
|
||||
cd /mnt
|
||||
jekyll new $JEKYLL_SITE
|
||||
fi
|
||||
|
||||
# build and serve
|
||||
cd /mnt/$JEKYLL_SITE
|
||||
bundle install --path $HOME/.gem
|
||||
bundle exec jekyll serve --host=0.0.0.0 --watch
|
Reference in New Issue