Skip to content

Commit 89e865a

Browse files
committed
infra: Do not copy files into image
The content is mounted at runtime. Signed-off-by: Alex Apostolescu <[email protected]>
1 parent 86aa1ea commit 89e865a

File tree

6 files changed

+358
-22
lines changed

6 files changed

+358
-22
lines changed

.github/workflows/deployment.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,61 @@ on:
44
push:
55
branches:
66
- main
7+
- ci/jekyll # TODO: Remove before merging to main
78

89
jobs:
910
deploy:
1011
name: Deploy to GitHub Pages
1112
runs-on: ubuntu-latest
1213
steps:
13-
- uses: actions/checkout@v3
14+
- name: Checkout the current branch to a `main` directory
15+
uses: actions/checkout@v4
16+
with:
17+
path: main
18+
19+
- name: Checkout `x86_64` branch
20+
uses: actions/checkout@v4
21+
with:
22+
ref: x86_64
23+
path: x86_64
24+
25+
- name: Build Docker image for Jekyll
26+
run: |
27+
docker build -t jekyll-image .
28+
working-directory: main
1429

15-
- name: Build Jekyll site
30+
- name: Build Jekyll site for x86
1631
run: |
17-
# GitHub-specific config
1832
echo "url: https://${{ github.repository_owner }}.github.io" >> _config.yaml
1933
echo "baseurl: /hardware-software-interface" >> _config.yaml
2034
21-
# Build Docker image for Jekyll
22-
docker build -t jekyll-image .
35+
# Build Jekyll site for x86
36+
docker run --rm \
37+
-v $(pwd):/base/app \
38+
-u $(id -u):$(id -g) \
39+
jekyll-image bundle exec jekyll build -s /base/app -d /base/app/_site
40+
working-directory: main
2341

24-
# Build Jekyll site
42+
- name: Build Jekyll site for x64
43+
run: |
44+
echo "url: https://${{ github.repository_owner }}.github.io" >> _config.yaml
45+
echo "baseurl: /hardware-software-interface/x86_64" >> _config.yaml
46+
47+
# Build Jekyll site for x86_64
48+
# Note: The x86_64 site is built in a separate directory.
2549
docker run --rm \
26-
-v ${{ github.workspace }}:/usr/src/app \
27-
jekyll-image bundle exec jekyll build
50+
-v $(pwd):/base/app \
51+
-u $(id -u):$(id -g) \
52+
jekyll-image bundle exec jekyll build -s /base/app -d /base/app/_site
53+
54+
# Move the x86_64 site under the main site directory
55+
mv _site ${{ github.workspace }}/main/_site/x86_64
56+
working-directory: x86_64
2857

2958
- name: Deploy to GitHub Pages
3059
uses: peaceiris/actions-gh-pages@v3
3160
with:
3261
github_token: ${{ secrets.GITHUB_TOKEN }}
33-
publish_dir: _site
62+
publish_dir: main/_site
3463
publish_branch: gh-pages
3564
enable_jekyll: true

.github/workflows/pr-deployment.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ jobs:
4040
4141
# Build Jekyll site
4242
docker run --rm \
43-
-v ${{ github.workspace }}:/usr/src/app/ \
44-
jekyll-site bundle exec jekyll build
43+
-v $(pwd):/base/app \
44+
-u $(id -u):$(id -g) \
45+
jekyll-image bundle exec jekyll build -s /base/app -d /base/app/_site
4546
4647
# The PR site is deployed as a subdirectory of the main site.
4748
# This means that it will be overwritten when the main site is redeployed.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,3 @@ _site/
6868
# Ignore folders generated by Bundler
6969
.bundle/
7070
vendor/
71-
*.lock

Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
FROM ruby:3.0-slim
1+
FROM ruby:3.4.4-slim
22

33
RUN apt-get update && apt-get install -y \
4+
git \
45
build-essential \
56
zlib1g-dev \
67
&& rm -rf /var/lib/apt/lists/*
78

8-
WORKDIR /usr/src/app
9+
WORKDIR /base
910

10-
COPY Gemfile ./
11-
RUN gem install bundler
12-
RUN bundle install
11+
COPY Gemfile Gemfile.lock /base/
12+
RUN gem install bundler:2.6.9 && bundle install
1313

1414
EXPOSE 4000
1515

16-
CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0"]
16+
# Expect the Jekyll source to be in /base/app
17+
CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0", "-s", "/base/app" ,"-d", "/base/app/_site"]

0 commit comments

Comments
 (0)