-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
76 lines (62 loc) · 1.76 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Stage 1: Download and build with Jekyll
FROM jekyll/jekyll:4.2.0 AS jekyll
# Install necessary tools and clean up cache
RUN apk update && apk add --no-cache --update \
findutils \
sed
WORKDIR /app
# Set the version as an argument
ARG GIT_COMMIT_SHA
ARG GIT_TAG
ARG GIT_BRANCH
ARG BUILD_DATE
ARG GIT_REMOTE
# Download tarball using tags
COPY Gemfile ./
COPY Gemfile.lock ./
COPY _config.yml ./
COPY LICENSE ./
COPY _assignments ./_assignments
COPY _data ./_data
COPY _includes ./_includes
COPY _layouts ./_layouts
COPY _sass ./_sass
COPY _units ./_units
COPY _workshops ./_workshops
COPY assets ./assets
COPY d3 ./d3
COPY pages ./pages
COPY scripts ./scripts
RUN chmod -R 777 /app
ENV JEKYLL_BUILD_REVISION=${GIT_COMMIT_SHA}
ENV PAGES_REPO_NWO=C2DH/ranketwo
# Build with Jekyll
RUN jekyll build
# create a file named version.json
# containing all these args
# - GIT_COMMIT
# - GIT_TAG
# - GIT_BRANCH
# - BUILD_DATE
# - GIT_REMOTE
RUN echo "{ \
\"gitCommitSha\": \"${GIT_COMMIT_SHA}\", \
\"gitTag\": \"${GIT_TAG}\", \
\"gitBranch\": \"${GIT_BRANCH}\", \
\"buildDate\": \"${BUILD_DATE}\", \
\"gitRemote\": \"${GIT_REMOTE}\" \
}" >> /app/_site/version.json
RUN cat /app/_site/version.json
RUN ls -la /app/_site
#
# Add the command to modify HTML files
# RUN find /app/_site -type f -name "*.html" -exec echo "Editing file: {}" \; -exec sed -i "s|\(Made with ❤ at <a href='https://c2dh.uni.lu/' target='_blank'>C2DH</a> (v. <a href='https://github.com/C2DH/ranketwo' target='_blank'>\)|\1${GIT_COMMIT_SHA}|g" {} +
# Stage 2: Bring the result to a Node image
FROM node:22.2.0-alpine3.20
WORKDIR /app
# Copy the result from the previous stage
COPY --from=jekyll /app/_site .
# list files
RUN ls -la
# Install and run pagefind
RUN npx [email protected] --site . --verbose