refactor docker image building
This commit is contained in:
parent
a5484dd46b
commit
e3a9b3fb41
@ -1,2 +0,0 @@
|
|||||||
FROM nginx:alpine
|
|
||||||
COPY _site /usr/share/nginx/html
|
|
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 "$@"
|
@ -5,32 +5,32 @@ services:
|
|||||||
|
|
||||||
serve:
|
serve:
|
||||||
container_name: isabelline-serve
|
container_name: isabelline-serve
|
||||||
image: jekyll/jekyll:4
|
image: docker.rzen.dev/jekyll-serve
|
||||||
command: jekyll serve --host 0.0.0.0 --future --draft --force_polling --livereload
|
# command: jekyll serve --host 0.0.0.0 --future --draft --force_polling --livereload
|
||||||
environment:
|
environment:
|
||||||
JEKYLL_ENV: local
|
JEKYLL_ENV: local
|
||||||
ports:
|
ports:
|
||||||
- 4000:4000
|
- 4000:4000
|
||||||
- 35729:35729
|
- 35729:35729
|
||||||
volumes:
|
volumes:
|
||||||
- .:/srv/jekyll
|
- .:/site
|
||||||
- .bundle:/usr/local/bundle
|
- .bundle:/usr/local/bundle
|
||||||
|
|
||||||
# build and push to rubygems.org
|
# build and push to rubygems.org
|
||||||
|
|
||||||
gem-push:
|
gem-push:
|
||||||
container_name: jekyll-gem-push
|
container_name: jekyll-gem-push
|
||||||
image: jekyll/jekyll:4.0
|
image: docker.rzen.dev/jekyll
|
||||||
command: >
|
command: |
|
||||||
bash -c "gem build -v jekyll-theme-isabelline.gemspec \
|
bash -c "gem build -v jekyll-theme-isabelline.gemspec
|
||||||
&& GEM_VER=`ruby -e '\
|
&& GEM_VER=`ruby -e '
|
||||||
require \"rubygems\"; \
|
require \"rubygems\";
|
||||||
spec = Gem::Specification::load(\"jekyll-theme-isabelline.gemspec\"); \
|
spec = Gem::Specification::load(\"jekyll-theme-isabelline.gemspec\");
|
||||||
puts \"#{spec.version}\"'` \
|
puts \"#{spec.version}\"'`
|
||||||
&& gem push jekyll-theme-isabelline-$${GEM_VER}.gem
|
&& gem push jekyll-theme-isabelline-$${GEM_VER}.gem
|
||||||
"
|
"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/srv/jekyll
|
- .:/site
|
||||||
- .bundle:/usr/local/bundle
|
- .bundle:/usr/local/bundle
|
||||||
- ./.gem:/root/.gem
|
- ./.gem:/root/.gem
|
||||||
|
|
||||||
@ -38,28 +38,28 @@ services:
|
|||||||
|
|
||||||
jekyll:
|
jekyll:
|
||||||
container_name: jekyll
|
container_name: jekyll
|
||||||
image: jekyll/jekyll:4.0
|
image: docker.rzen.dev/jekyll
|
||||||
entrypoint: jekyll
|
entrypoint: jekyll
|
||||||
environment:
|
environment:
|
||||||
JEKYLL_ENV: local
|
JEKYLL_ENV: local
|
||||||
volumes:
|
volumes:
|
||||||
- .bundle:/usr/local/bundle
|
- .bundle:/usr/local/bundle
|
||||||
- .:/srv/jekyll
|
- .:/site
|
||||||
|
|
||||||
gem:
|
gem:
|
||||||
container_name: jekyll-gem
|
container_name: jekyll-gem
|
||||||
image: jekyll/jekyll:4.0
|
image: docker.rzen.dev/jekyll
|
||||||
entrypoint: gem
|
entrypoint: gem
|
||||||
volumes:
|
volumes:
|
||||||
- .bundle:/usr/local/bundle
|
- .bundle:/usr/local/bundle
|
||||||
- .:/srv/jekyll
|
- .:/site
|
||||||
|
- ./.gem:/root/.gem
|
||||||
|
|
||||||
bundle:
|
bundle:
|
||||||
container_name: bundle
|
container_name: bundle
|
||||||
image: jekyll/jekyll:4.0
|
image: jekyll/jekyll:4
|
||||||
entrypoint: bundle
|
entrypoint: bundle
|
||||||
volumes:
|
volumes:
|
||||||
# - ./.bundle:/home/jekyll/.bundle
|
- .bundle:/usr/local/bundle
|
||||||
- ./.bundle:/usr/local/bundle
|
- .:/site
|
||||||
- .:/srv/jekyll
|
|
||||||
- ./.gem:/root/.gem
|
- ./.gem:/root/.gem
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Gem::Specification.new do |spec|
|
Gem::Specification.new do |spec|
|
||||||
spec.version = "0.1.20"
|
spec.version = "0.1.21"
|
||||||
|
|
||||||
spec.name = "jekyll-theme-isabelline"
|
spec.name = "jekyll-theme-isabelline"
|
||||||
spec.authors = ["Rouslan Zenetl"]
|
spec.authors = ["Rouslan Zenetl"]
|
||||||
@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|||||||
|
|
||||||
# work out which files to include with the theme
|
# work out which files to include with the theme
|
||||||
spec.files = `git ls-files -z`.split("\x0").select do |f|
|
spec.files = `git ls-files -z`.split("\x0").select do |f|
|
||||||
f.match(%r!^(assets|_(includes|layouts|sass)/|(LICENSE|README|CHANGELOG|index)((\.(txt|md|html)|$)))!i)
|
f.match(%r!^(assets|build|_(includes|layouts|sass)/|(LICENSE|README|CHANGELOG|index)((\.(txt|md|html)|$)))!i)
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO: jekyll ver should be same as image in docker-compose.yaml
|
# TODO: jekyll ver should be same as image in docker-compose.yaml
|
||||||
|
Loading…
Reference in New Issue
Block a user