-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (54 loc) 路 1.57 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (54 loc) 路 1.57 KB
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
# syntax=docker/dockerfile:1
ARG RUBY_VERSION=3.4
ARG BUNDLER_VERSION=4.0.14
ARG JEKYLL_ENV=development
FROM ruby:${RUBY_VERSION}-trixie AS base
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends bash ca-certificates curl git \
&& curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt-get install -y --no-install-recommends nodejs
WORKDIR /src
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache <<EOT
set -e
corepack enable
yarn --version
yarn config set --home enableTelemetry 0
EOT
FROM base AS gem
ARG BUNDLER_VERSION
COPY Gemfile* .
RUN gem uninstall -aIx bundler \
&& gem install bundler -v ${BUNDLER_VERSION} \
&& bundle install --jobs 4 --retry 3
FROM gem AS vendored
ARG BUNDLER_VERSION
RUN bundle update \
&& mkdir /out \
&& cp Gemfile.lock /out
FROM scratch AS vendor
COPY --from=vendored /out /
FROM gem AS node
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
yarn install --immutable
FROM node AS generate
ARG JEKYLL_ENV
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \
--mount=type=secret,id=GITHUB_TOKEN,env=GH_TOKEN \
yarn build && mv /src/web /out
FROM generate AS htmlproofer
RUN --mount=type=bind,target=.,rw \
htmlproofer ./web/download \
--allow-missing-href \
--allow-hash-href \
--assume_extension \
--check-favicon \
--http-status-ignore 403 \
--only-4xx \
--alt-ignore "/.*/" \
--log-level=:debug
FROM scratch AS release
COPY --from=generate /out /