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