2024-04-28 13:42:12 +00:00
|
|
|
# use Ruby as the foundation since Jekyll needs it
|
|
|
|
# Alpine to keep the container a bit lighter
|
2024-02-01 12:50:12 +00:00
|
|
|
FROM ruby:3-alpine AS builder
|
|
|
|
LABEL stage=milksad-website-builder
|
2024-04-28 13:42:12 +00:00
|
|
|
|
|
|
|
# install necessary system dependencies for Jekyll and plugins
|
|
|
|
RUN apk update && \
|
|
|
|
apk add g++ make imagemagick imagemagick-dev imagemagick-libs && \
|
|
|
|
rm -rf /var/cache/apk/*
|
|
|
|
|
2023-08-08 21:11:00 +00:00
|
|
|
RUN mkdir -p /home
|
2024-04-28 13:42:12 +00:00
|
|
|
# also creates user directory
|
|
|
|
RUN adduser -D builder
|
|
|
|
USER builder
|
|
|
|
RUN mkdir -p /home/builder/workdir
|
|
|
|
WORKDIR /home/builder/workdir
|
2023-08-08 21:11:00 +00:00
|
|
|
|
2024-04-28 13:42:12 +00:00
|
|
|
# copy the Jekyll website contents into the container
|
|
|
|
# this includes Gemfile and Gemfile.lock
|
|
|
|
# reminder: .dockerignore should specify a good ignorelist for this
|
|
|
|
COPY --chown=builder . .
|
2023-11-11 14:41:20 +00:00
|
|
|
|
2024-04-28 13:42:12 +00:00
|
|
|
# install Gems
|
|
|
|
RUN bundle install
|
|
|
|
|
|
|
|
# do the initial website build
|
|
|
|
RUN jekyll build
|
2023-11-11 14:41:20 +00:00
|
|
|
|
2024-04-28 13:42:12 +00:00
|
|
|
# note: this Dockerfile is no longer responsible for serving the content to end users
|