2024-07-10 07:56:42 +00:00
|
|
|
# Stage 1: Build the Jekyll site
|
|
|
|
FROM ruby:3.0.0 AS builder
|
2024-07-09 12:36:39 +00:00
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
build-essential \
|
|
|
|
git \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
# Install the specific version of Bundler
|
|
|
|
RUN gem install bundler:2.2.13
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
WORKDIR /srv/jekyll
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
# Copy Gemfile and Gemfile.lock and install dependencies
|
|
|
|
COPY Gemfile Gemfile.lock ./
|
|
|
|
RUN bundle _2.2.13_ install
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
# Copy the rest of the application files
|
|
|
|
COPY . .
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
# Build the Jekyll site
|
|
|
|
RUN jekyll build -d /dist
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
# Stage 2: Serve the Jekyll site using Nginx
|
|
|
|
FROM nginx:1.26.0
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
WORKDIR /usr/share/nginx/html
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
# Copy the generated site from the builder stage
|
|
|
|
COPY --from=builder /dist .
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
# Expose port 80 for the web server
|
|
|
|
EXPOSE 80
|
2024-07-09 12:36:39 +00:00
|
|
|
|
2024-07-10 07:56:42 +00:00
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|