Improve build system, update Jekyll dependencies

This commit is contained in:
Christian Reitter 2024-02-01 13:50:12 +01:00
parent ed7622eee9
commit 2abfff2f92
6 changed files with 60 additions and 45 deletions

View File

@ -1,3 +1,11 @@
Dockerfile Dockerfile
Makefile Makefile
_site _site/
site_export/
.vscode/
.git/
.gitignore
.gitmodules
.dockerignore
build.sh
nginx.conf

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
_site _site
site_export
.sass-cache .sass-cache
.jekyll-cache .jekyll-cache
.jekyll-metadata .jekyll-metadata

View File

@ -1,5 +1,5 @@
FROM ruby:3.2-alpine AS builder FROM ruby:3-alpine AS builder
LABEL stage=distrust-co-builder LABEL stage=milksad-website-builder
RUN apk update && apk add g++ make imagemagick imagemagick-dev imagemagick-libs RUN apk update && apk add g++ make imagemagick imagemagick-dev imagemagick-libs
RUN mkdir -p /home RUN mkdir -p /home
COPY Gemfile /home COPY Gemfile /home
@ -11,16 +11,15 @@ RUN bundle install
COPY . /home COPY . /home
RUN jekyll build RUN jekyll build
FROM debian:bookworm AS mime-types # FROM debian:bookworm AS mime-types
RUN apt-get update && apt-get install -y media-types # RUN apt-get update && apt-get install -y media-types
# RUN echo 'types {' > /tmp/mime.types
# RUN sed -e '/^$/d' -e 's/$/;/' /etc/mime.types >> /tmp/mime.types
# RUN echo '}' >> /tmp/mime.types
RUN echo 'types {' > /tmp/mime.types
RUN sed -e '/^$/d' -e 's/$/;/' /etc/mime.types >> /tmp/mime.types
RUN echo '}' >> /tmp/mime.types
FROM nginx:1.25 # FROM nginx:1.25
COPY nginx.conf /etc/nginx/nginx.conf # COPY nginx.conf /etc/nginx/nginx.conf
# extend the recognized MIME types # COPY --from=builder /home/_site /usr/share/nginx/html
# this allows nginx to detect and compress font files # COPY --from=mime-types /tmp/mime.types /etc/nginx/mime.types
COPY --from=mime-types /tmp/mime.types /etc/nginx/mime.types # COPY --from=builder /home/_site /usr/share/nginx/html
COPY --from=builder /home/_site /usr/share/nginx/html

View File

@ -1,21 +1,21 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
addressable (2.8.4) addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0) public_suffix (>= 2.0.2, < 6.0)
colorator (1.1.0) colorator (1.1.0)
concurrent-ruby (1.2.2) concurrent-ruby (1.2.3)
em-websocket (0.5.3) em-websocket (0.5.3)
eventmachine (>= 0.12.9) eventmachine (>= 0.12.9)
http_parser.rb (~> 0) http_parser.rb (~> 0)
eventmachine (1.2.7) eventmachine (1.2.7)
ffi (1.15.5) ffi (1.16.3)
forwardable-extended (2.6.0) forwardable-extended (2.6.0)
google-protobuf (3.23.4-x86_64-linux) google-protobuf (3.25.2)
http_parser.rb (0.8.0) http_parser.rb (0.8.0)
i18n (1.14.1) i18n (1.14.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jekyll (4.3.2) jekyll (4.3.3)
addressable (~> 2.4) addressable (~> 2.4)
colorator (~> 1.0) colorator (~> 1.0)
em-websocket (~> 0.5) em-websocket (~> 0.5)
@ -51,23 +51,21 @@ GEM
mercenary (0.4.0) mercenary (0.4.0)
pathutil (0.16.2) pathutil (0.16.2)
forwardable-extended (~> 2.6) forwardable-extended (~> 2.6)
public_suffix (5.0.3) public_suffix (5.0.4)
rake (13.0.6)
rb-fsevent (0.11.2) rb-fsevent (0.11.2)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
rexml (3.2.5) rexml (3.2.6)
rmagick (4.3.0) rmagick (4.3.0)
rouge (4.1.2) rouge (4.2.0)
safe_yaml (1.0.5) safe_yaml (1.0.5)
sass-embedded (1.63.6) sass-embedded (1.70.0-x86_64-linux-gnu)
google-protobuf (~> 3.23) google-protobuf (~> 3.25)
rake (>= 13.0.0) sass-embedded (1.70.0-x86_64-linux-musl)
sass-embedded (1.63.6-x86_64-linux-musl) google-protobuf (~> 3.25)
google-protobuf (~> 3.23)
terminal-table (3.0.2) terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3) unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.4.2) unicode-display_width (2.5.0)
webrick (1.8.1) webrick (1.8.1)
PLATFORMS PLATFORMS

View File

@ -1,32 +1,42 @@
# flexible use with docker and podman
platform ?= docker
.PHONY: build .PHONY: build
build: build:
# Build Docker image # Build Docker image
docker build -t milksad-distrust-co . $(platform) build -t milksad-website .
.PHONY: fullclean .PHONY: fullclean
fullclean: clean fullclean: clean
docker rmi milksad-distrust-co -f $(platform) rmi milksad-website-builder -f
docker image prune --filter label=stage=distrust-co-builder $(platform) image prune --filter label=stage=milksad-website-builder
.PHONY: clean .PHONY: clean
clean: clean:
rm -r _site rm -r site_export
_site: build site_export: build
rm -rf _site rm -rf site_export
mkdir -p _site mkdir -p site_export
docker run milksad-distrust-co tar c -C /usr/share/nginx/html . | tar x -C _site $(platform) run milksad-website tar c -C /home/_site . | tar x -C site_export
.PHONY: serve #.PHONY: serve
serve: build #serve: build
# Run Docker container with listener for current dir and port mapping # # Run Docker container with listener for current dir and port mapping
docker run --rm -p 0.0.0.0:4000:80 -it milksad-distrust-co # $(platform) run --rm -p 0.0.0.0:4000:80 -it milksad-website
upload: site_export
rsync -av --delete site_export/ milksad-website:/var/www/html
.PHONY: build-dev .PHONY: build-dev
build-dev: build-dev:
# Build Docker image # Build Docker image
docker build --target builder -t dev-milksad-distrust-co . $(platform) build --target builder -t dev-milksad-website .
.PHONY: dev .PHONY: dev
dev: build-dev dev: build-dev
docker run --rm --expose 4000 -p 127.0.0.1:4000:4000 -v ${PWD}:/home -it dev-milksad-distrust-co jekyll serve -H 0.0.0.0 $(platform) run --rm --expose 4000 -p 127.0.0.1:4000:4000 -v ${PWD}:/home -it dev-milksad-website jekyll serve -H 0.0.0.0
.PHONY: dev-shell
dev-shell: build-dev
$(platform) run --rm --expose 4000 -p 127.0.0.1:4000:4000 -v ${PWD}:/home -it dev-milksad-website sh

View File

@ -65,8 +65,7 @@ exclude:
- "*.conf" - "*.conf"
- "README.md" - "README.md"
- "LICENSE" - "LICENSE"
- "site_export"
responsive_image: responsive_image:
# Path to the image template. # Path to the image template.