refactor docker image building
This commit is contained in:
17
build/Dockerfile
Normal file
17
build/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
# borrowed from https://github.com/BretFisher/jekyll-serve
|
||||
|
||||
FROM ruby:2.7-alpine
|
||||
|
||||
RUN apk add --no-cache build-base gcc bash cmake git
|
||||
RUN apk add --no-cache imagemagick
|
||||
|
||||
# install both bundler 1.x and 2.x
|
||||
RUN gem install bundler -v "~>1.0" && gem install bundler jekyll
|
||||
|
||||
EXPOSE 4000
|
||||
|
||||
WORKDIR /site
|
||||
|
||||
ENTRYPOINT [ "jekyll" ]
|
||||
|
||||
CMD [ "--help" ]
|
8
build/Dockerfile-serve
Normal file
8
build/Dockerfile-serve
Normal file
@ -0,0 +1,8 @@
|
||||
FROM docker.rzen.dev/jekyll:latest
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
# on every container start, check if Gemfile exists and warn if it's missing
|
||||
ENTRYPOINT [ "docker-entrypoint.sh" ]
|
||||
|
||||
CMD [ "bundle", "exec", "jekyll", "serve", "--force_polling", "-H", "0.0.0.0", "-P", "4000" ]
|
19
build/docker-entrypoint.sh
Executable file
19
build/docker-entrypoint.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ ! -f Gemfile ]; then
|
||||
echo "NOTE: hmm, I don't see a Gemfile so I don't think there's a jekyll site here"
|
||||
echo "Either you didn't mount a volume, or you mounted it incorrectly."
|
||||
echo "Be sure you're in your jekyll site root and use something like this to launch"
|
||||
echo ""
|
||||
echo "docker run -p 80:4000 -v \$(pwd):/site bretfisher/jekyll-serve"
|
||||
echo ""
|
||||
echo "NOTE: To create a new site, you can use the sister image bretfisher/jekyll like:"
|
||||
echo ""
|
||||
echo "docker run -v \$(pwd):/site bretfisher/jekyll new ."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bundle install --retry 5 --jobs 20
|
||||
|
||||
exec "$@"
|
Reference in New Issue
Block a user