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
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_export
.sass-cache
.jekyll-cache
.jekyll-metadata

View File

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

View File

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

View File

@ -1,32 +1,42 @@
# flexible use with docker and podman
platform ?= docker
.PHONY: build
build:
# Build Docker image
docker build -t milksad-distrust-co .
$(platform) build -t milksad-website .
.PHONY: fullclean
fullclean: clean
docker rmi milksad-distrust-co -f
docker image prune --filter label=stage=distrust-co-builder
$(platform) rmi milksad-website-builder -f
$(platform) image prune --filter label=stage=milksad-website-builder
.PHONY: clean
clean:
rm -r _site
rm -r site_export
_site: build
rm -rf _site
mkdir -p _site
docker run milksad-distrust-co tar c -C /usr/share/nginx/html . | tar x -C _site
site_export: build
rm -rf site_export
mkdir -p site_export
$(platform) run milksad-website tar c -C /home/_site . | tar x -C site_export
.PHONY: serve
serve: build
# 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
#.PHONY: serve
#serve: build
# # Run Docker container with listener for current dir and port mapping
# $(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
build-dev:
# Build Docker image
docker build --target builder -t dev-milksad-distrust-co .
$(platform) build --target builder -t dev-milksad-website .
.PHONY: 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"
- "README.md"
- "LICENSE"
- "site_export"
responsive_image:
# Path to the image template.