1- # Ruby image to use, change with [--build-arg RUBY_VERSION="3.3.0"]
2- ARG RUBY_VERSION="3.3.0"
3- # Alpine image to use, change with [--build-arg ALPINE_VERSION="3.19"]
4- ARG ALPINE_VERSION="3.19"
5- # s3deploy version to use
6- ARG S3DEPLOY_VERSION="2.11.0"
7-
8-
9- FROM ruby:${RUBY_VERSION}-alpine${ALPINE_VERSION} AS dltj-jekyll-builder
10-
11- # Install build dependencies
12- RUN set -eux; \
13- apk add --no-cache --virtual build-deps \
14- build-base \
15- zlib-dev \
16- git
17-
18- # Install Bundler
19- RUN set -eux; gem install bundler
20-
21- COPY Gemfile-docker ./Gemfile
22-
23- ENV BUNDLE_HOME=/usr/local/bundle \
24- BUNDLE_APP_CONFIG=/usr/local/bundle \
25- BUNDLE_DISABLE_PLATFORM_WARNINGS=true \
26- BUNDLE_BIN=/usr/local/bundle/bin
27-
28- # Install gems from `Gemfile` via Bundler
29- RUN set -eux; \
30- bundler install
1+ # Use Python as the base image
2+ FROM python:3.12.7-slim
313
4+ # s3deploy version to use
5+ ARG S3DEPLOY_VERSION="2.12.1"
326
33- FROM ruby:${RUBY_VERSION}-alpine${ALPINE_VERSION} AS dltj-jekyll-runner
34- # Repeat ARG here because [Docker is stupid](https://docs.docker.com/reference/dockerfile/#understand-how-arg-and-from-interact)
35- ARG S3DEPLOY_VERSION
7+ # Set the working directory
8+ WORKDIR /app
369
37- # `git` is needed by the last-modified-at plugin
38- # `nodejs` is needed by one of the gems
39- # `jemalloc` is the malloc replacement
40- RUN set -eux; \
41- apk add --no-cache --virtual runner-deps \
10+ # Install necessary system dependencies and PDM
11+ RUN apt-get update && apt-get install -y \
4212 git \
43- nodejs \
44- jemalloc \
45- aws-cli \
4613 curl \
47- jq
14+ && apt-get clean \
15+ && rm -rf /var/lib/apt/lists/* \
16+ # Install PDM
17+ && curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py | python3 -
4818
19+ # Ensure /root/.local/bin is in PATH
20+ ENV PATH="/root/.local/bin:$PATH"
21+
22+ # Get the `s3deploy` program
4923RUN set -eux; \
5024 curl -s -S -L -f https://github.com/bep/s3deploy/releases/download/v${S3DEPLOY_VERSION}/s3deploy_${S3DEPLOY_VERSION}_linux-amd64.tar.gz -o /tmp/s3deploy.tar.gz; \
5125 tar -xzf /tmp/s3deploy.tar.gz --directory /usr/local/bin s3deploy; \
5226 rm /tmp/s3deploy.tar.gz
5327
54- # Install jemalloc — see https://github.com/jemalloc/jemalloc/issues/1443#issuecomment-1895891270
55- RUN set -eux; \
56- apk add --no-cache patchelf; \
57- patchelf --add-needed libjemalloc.so.2 /usr/local/bin/ruby; \
58- apk del patchelf
28+ # Copy the pyproject.toml and pdm.lock files
29+ COPY pyproject.toml pdm.lock* util /app/
30+
31+ # Install the dependencies
32+ RUN pdm install --prod --no-self
33+
34+ # Clone the specified Pelican source repository
35+ RUN git clone https://github.com/dltj/pelican.git /app/pelican
36+
37+ # Clone the specified theme repository
38+ RUN git clone https://github.com/dltj/pelican-hyde.git /app/pelican-themes/pelican-hyde
5939
60- ENV RUBY_YJIT_ENABLE=1 \
61- MALLOC_CONF= "background_thread:true,metadata_thp:auto,dirty_decay_ms:500,muzzy_decay_ms:5000,narenas:2"
40+ # Install Pelican from the cloned source
41+ RUN pip install /app/pelican
6242
63- COPY --from=dltj-jekyll-builder /usr/local/bundle /usr/local/bundle
64- COPY --from=dltj-jekyll-builder /Gemfile* /
43+ # Copy your Pelican configuration files to the container
44+ COPY pelicanconf.py /app/pelicanconf.py
45+ COPY publishconf.py /app/publishconf.py
6546
66- # Clean up
67- WORKDIR /srv/jekyll
47+ # Expose port 8000 for serving
48+ EXPOSE 8000
6849
69- EXPOSE 4000
70- ENTRYPOINT ["bundler " , "exec " , "jekyll " ]
71- CMD ["--version" ]
50+ # Let's get into it!
51+ ENTRYPOINT ["pdm " , "run " , "pelican " ]
52+ CMD ["--version" ]
0 commit comments