Skip to content

Commit 8d56e0b

Browse files
authored
Merge pull request #289 from AKSW/feature/addDockerImage
Feature/add docker image
2 parents 8521989 + 01123e8 commit 8d56e0b

File tree

7 files changed

+106
-3
lines changed

7 files changed

+106
-3
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*
2+
!docker-resources
3+
!lib
4+
!Gemfile
5+
!jekyll-rdf.gemspec
6+
!LICENSE
7+
!README.md

.github/workflows/build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'develop'
8+
9+
jobs:
10+
docker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Git describe
14+
id: ghd
15+
uses: proudust/gh-describe@v1
16+
- name: Check outputs
17+
run: |
18+
echo "describe: ${{ steps.ghd.outputs.describe }}"
19+
-
20+
name: Set up QEMU
21+
uses: docker/setup-qemu-action@v2
22+
-
23+
name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v2
25+
-
26+
name: Login to GitHub Container Registry
27+
uses: docker/login-action@v2
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
- name: Extract metadata (tags, labels) for Docker
33+
id: meta
34+
uses: docker/[email protected]
35+
with:
36+
images: |
37+
ghcr.io/aksw/jekyll-rdf
38+
-
39+
name: Build and push
40+
uses: docker/build-push-action@v3
41+
with:
42+
push: true
43+
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
44+
build-args: VERSION=${{ steps.ghd.outputs.describe }}
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
## [Unrelease]
88

99
### Added
10-
-
10+
- Dockerfile to build docker/podman image
11+
- Taskfile to build docker image
12+
- GitHub Action workflow
1113

1214
### Changed
1315
- Switch version handling to `git describe`

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ruby:3.1-slim AS builder
2+
3+
RUN apt-get update && apt-get -y install build-essential && rm -rf /var/lib/apt/lists/*
4+
WORKDIR jekyll-rdf
5+
6+
ADD . .
7+
ARG VERSION
8+
RUN gem build jekyll-rdf.gemspec && \
9+
gem install jekyll-rdf-*.gem mustache
10+
11+
FROM ruby:3.1-slim AS slim
12+
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
13+
14+
WORKDIR /data
15+
16+
CMD /usr/local/bundle/bin/jekyll build
17+
18+
FROM ruby:3.1-slim
19+
COPY --from=builder /jekyll-rdf/docker-resources/ /docker-resources
20+
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
21+
RUN apt-get update && apt-get -y install build-essential && rm -rf /var/lib/apt/lists/*
22+
23+
WORKDIR /data
24+
25+
CMD /docker-resources/entrypoint.sh

Taskfile.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3'
2+
3+
env:
4+
VERSION:
5+
sh: git describe --tags --dirty --always
6+
7+
tasks:
8+
9+
default:
10+
desc: The list of all defined tasks
11+
cmds:
12+
- task -a
13+
14+
docker:build:
15+
desc: The list of all defined tasks
16+
cmds:
17+
- docker build --no-cache --build-arg VERSION={{.VERSION}} -t jekyll-rdf:{{.VERSION}} .

docker-resources/entrypoint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
bundle install
4+
jekyll build

jekyll-rdf.gemspec

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# coding: utf-8
2-
VERSION = '3.2.0'
3-
RELEASE_VERSION = `git describe --tags --dirty --always`
2+
RELEASE_VERSION = case
3+
when ENV['VERSION'] then ENV['VERSION']
4+
else `git describe --tags --dirty --always`
5+
end
46

57
Gem::Specification.new do |s|
68
s.name = 'jekyll-rdf'

0 commit comments

Comments
 (0)