Skip to content

Commit 16e92a7

Browse files
authored
Build the site on CI using Docker (#293)
Signed-off-by: Juan Cruz Viotti <[email protected]>
1 parent fffbb9a commit 16e92a7

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

.github/workflows/website-build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,4 @@ jobs:
1212
steps:
1313
- name: Checkout
1414
uses: actions/checkout@v3
15-
- run: sudo apt update
16-
- run: sudo apt install -y hugo
17-
- run: make html
15+
- run: make docker

.github/workflows/website-deploy.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ jobs:
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v3
25-
- run: sudo apt update
26-
- run: sudo apt install -y hugo
27-
- run: make html
25+
- run: make docker
2826
- name: Setup Pages
2927
uses: actions/configure-pages@v5
3028
- name: Upload artifact

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM debian:bookworm-slim
2+
RUN apt-get update \
3+
&& apt-get install -y make hugo nodejs npm \
4+
&& rm -rf /var/lib/apt/lists/*
5+
6+
COPY assets /site/assets
7+
COPY config /site/config
8+
COPY content /site/content
9+
COPY layouts /site/layouts
10+
COPY static /site/static
11+
COPY vendor /site/vendor
12+
COPY Makefile /site/Makefile
13+
COPY package-lock.json /site/package-lock.json
14+
COPY package.json /site/package.json
15+
16+
RUN make -C /site node_modules
17+
CMD ["make", "-C", "/site", "html"]

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
HUGO ?= hugo
44
RMRF ?= rm -rf
55
NPM ?= npm
6+
DOCKER ?= docker
67

78
node_modules: package.json package-lock.json
89
$(NPM) ci
@@ -18,3 +19,9 @@ html: node_modules
1819
.PHONY: clean
1920
clean:
2021
$(RMRF) resources dist
22+
$(DOCKER) system prune --force --all --volumes || true
23+
24+
.PHONY: docker
25+
docker:
26+
$(DOCKER) build --tag learnjsonschema .
27+
$(DOCKER) run --rm --volume "$(PWD)/dist:/site/dist" learnjsonschema

0 commit comments

Comments
 (0)