-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jekyll): Add jekyll container with plantuml
- Loading branch information
Showing
12 changed files
with
197 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Build jekyll container | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'jekyll-v*' | ||
pull_request: | ||
paths: | ||
- 'jekyll/**' | ||
- '.github/workflows/**' | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build-jekyll-container: | ||
permissions: | ||
contents: read | ||
packages: write | ||
uses: ./.github/workflows/build-container.yml | ||
with: | ||
component: "jekyll" | ||
publish: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/jekyll-v') }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# https://stackoverflow.com/questions/28097064/dockerignore-ignore-everything-except-a-file-and-the-dockerfile | ||
# | ||
|
||
# Ignore everything | ||
* | ||
|
||
# Allow files and directories | ||
!/rootfs | ||
|
||
# Ignore unnecessary files inside allowed directories | ||
# This should go after the allowed directories | ||
**/*~ | ||
**/*.log | ||
**/.DS_Store | ||
**/Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
site | ||
.jekyll-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ARG JEKYLL_VERSION=4.2.2 | ||
|
||
FROM jekyll/jekyll:${JEKYLL_VERSION} | ||
|
||
# Copy files from repository. | ||
# including container-test.sh | ||
COPY ./rootfs / | ||
|
||
RUN chmod a+x /usr/local/bin/plantuml && \ | ||
wget https://github.com/plantuml/plantuml/releases/download/snapshot/plantuml-SNAPSHOT.jar && \ | ||
mkdir -p /usr/local/share/plantuml && \ | ||
mv plantuml-SNAPSHOT.jar /usr/local/share/plantuml/plantuml.jar && \ | ||
gem install jekyll-plantuml | ||
|
||
CMD ["jekyll", "--help"] | ||
|
||
ENTRYPOINT ["/usr/jekyll/bin/entrypoint"] | ||
|
||
WORKDIR /srv/jekyll | ||
|
||
VOLUME /srv/jekyll | ||
|
||
EXPOSE 35729 | ||
|
||
EXPOSE 4000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Git variables | ||
|
||
#GIT_REPOSITORY_NAME := $(shell basename `git rev-parse --show-toplevel`) | ||
GIT_REPOSITORY_NAME := plantuml/jekyll | ||
|
||
GIT_VERSION := $(shell git describe --always --tags --long --dirty | sed -e 's/\-0//' -e 's/\-g.......//') | ||
|
||
# Docker variables | ||
|
||
DOCKER_IMAGE_TAG ?= $(GIT_REPOSITORY_NAME):$(GIT_VERSION) | ||
DOCKER_IMAGE_NAME := plantuml/jekyll | ||
|
||
JEKYLL_SITE_NAME ?= myBlog | ||
JEKYLL_SITE_ROOT_DIR := $(shell pwd)/site | ||
|
||
# ----------------------------------------------------------------------------- | ||
# The first "make" target runs as default. | ||
# ----------------------------------------------------------------------------- | ||
|
||
.PHONY: default | ||
default: help | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Docker-based builds | ||
# ----------------------------------------------------------------------------- | ||
|
||
.PHONY: build | ||
build: | ||
docker build \ | ||
--tag $(DOCKER_IMAGE_NAME) \ | ||
--tag $(DOCKER_IMAGE_NAME):$(GIT_VERSION) \ | ||
. | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Clean up targets | ||
# ----------------------------------------------------------------------------- | ||
|
||
.PHONY: clean | ||
clean: | ||
-docker rmi --force \ | ||
$(DOCKER_IMAGE_NAME):$(GIT_VERSION) \ | ||
$(DOCKER_IMAGE_NAME) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Test image | ||
# ----------------------------------------------------------------------------- | ||
|
||
.PHONY: test | ||
test: | ||
docker run --rm --entrypoint /bin/bash $(DOCKER_IMAGE_NAME) container-test.sh | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Serve | ||
# ----------------------------------------------------------------------------- | ||
|
||
.PHONY: serve | ||
serve: | ||
docker run --rm -it --volume="$(JEKYLL_SITE_ROOT_DIR):/srv/jekyll:Z" -p 4000:4000 $(DOCKER_IMAGE_NAME) jekyll-serve.sh $(JEKYLL_SITE_NAME) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Enter | ||
# ----------------------------------------------------------------------------- | ||
|
||
.PHONY: enter | ||
enter: | ||
docker run --rm -it --volume="$(JEKYLL_SITE_ROOT_DIR):/srv/jekyll:Z" $(DOCKER_IMAGE_NAME) bash | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Help | ||
# ----------------------------------------------------------------------------- | ||
|
||
.PHONY: help | ||
help: | ||
@echo "List of make targets:" | ||
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Jekyll container | ||
|
||
Container base on [jekyll/jekyll](https://hub.docker.com/r/jekyll/jekyll/) container. | ||
|
||
- JEKYLL_VERSION: 4.2.2 | ||
|
||
## Usage | ||
|
||
### For testing | ||
|
||
```shell | ||
gh repo clone plantuml/docker | ||
cd docker/jekyll | ||
mkdir site | ||
|
||
make build test serve | ||
``` | ||
This will create a `myBlog` jekyll site under the `site` directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
jekyll --version | ||
|
||
plantuml --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
set -xeuo pipefail | ||
|
||
JEKYLL_SITE_NAME="${1?site name missing}" | ||
JEKYLL_SITE_ROOT_DIR=/srv/jekyll | ||
JEKYLL_SITE_DIR="$JEKYLL_SITE_ROOT_DIR/$JEKYLL_SITE_NAME" | ||
|
||
cd $JEKYLL_SITE_ROOT_DIR | ||
|
||
chown jekyll:jekyll -R $JEKYLL_SITE_ROOT_DIR | ||
|
||
if [ ! -d $JEKYLL_SITE_DIR ]; then | ||
echo "create site $JEKYLL_SITE_NAME..." | ||
jekyll new $JEKYLL_SITE_NAME | ||
cd $JEKYLL_SITE_NAME | ||
echo "add missing bundles..." | ||
bundle add \ | ||
public_suffix \ | ||
webrick | ||
echo "site $JEKYLL_SITE_NAME is ready" | ||
fi | ||
|
||
echo "starting site $JEKYLL_SITE_NAME..." | ||
cd $JEKYLL_SITE_DIR | ||
jekyll serve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
java -jar /usr/local/share/plantuml/plantuml.jar "$1" "$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ | |
"packages": { | ||
"graalvm": { | ||
"component": "graalvm" | ||
}, | ||
"jekyll": { | ||
"component": "jekyll" | ||
} | ||
} | ||
} |