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
COPY Gemfile.lock /home
# copying _vendor is not needed at the moment
# COPY _vendor /home/_vendor
WORKDIR /home
RUN bundle install
COPY . /home
RUN jekyll build

# 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


# 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
