maintainer |
---|
sheeeng |
Docker built Jekyll image for building Praqma's website.
See Docker Hub or Docker Cloud repository that automatically builds from the GitHub repository.
A long time ago in a galaxy far, far away....
Praqma's website was published directly on GitHub Pages. Therefore, we use a Docker built Jekyll image that resembles implementation of GitHub Pages in order to test our commits before publishing them.
This image has originated from obsolete docker-gh-pages repository and obsolete gh-pages image.
GitHub Pages list the dependencies and versions of Jekyll, Liquid, KramDown etc. on their production system. The information are also available in JSON format.
This repository aims to provide a Docker image that resembles GitHub Pages. We expect that our tested pages against this image will behave in the same manner after published to GitHub Pages. It contains pages-gem for Ruby, which is maintained by GitHub. The pages-gem is always up to date with the dependencies and versions running live on GitHub Pages.
Since then, we have moved our website to the cloud....
See CONTRIBUTION.md file.
Setup your environment variables before using the scripts. Verify your environment variables were setup properly.
export JEKYLL_SITE_DIR=$(PWD)/../praqma.com
export DOCKER_IMAGE_NAME=praqma/jekyll:latest
echo $JEKYLL_SITE_DIR
echo $DOCKER_IMAGE_NAME
Optionally, use export DEBUG=1;
in terminal before using the scripts if commands to be displayed prior to execution.
set JEKYLL_SITE_DIR=%CD%\..\praqma.com
set DOCKER_IMAGE_NAME=praqma/jekyll:latest
echo %JEKYLL_SITE_DIR%
echo %DOCKER_IMAGE_NAME%
$env:JEKYLL_SITE_DIR = "$PWD\..\praqma.com"
$env:DOCKER_IMAGE_NAME = "praqma/jekyll:latest"
Write-Host $env:JEKYLL_SITE_DIR
Write-Host $env:DOCKER_IMAGE_NAME
Pull the image from Docker.
docker pull $DOCKER_IMAGE_NAME
As an alternative, build the image locally.
docker build --tag $DOCKER_IMAGE_NAME .
Scripts:
Clone a Jekyll based website from the Internet at the same parent directory level of this repository.
Using praqma.com
directory as an example. You should have similar directory structure shown below.
$ tree -d -L 1
.
├── jekyll
└── praqma.com
As an alternative, create a new Jekyll based website locally.
Scripts:
Check the version of jekyll
and ruby
.
docker run \
--rm \
--tty \
$DOCKER_IMAGE_NAME \
jekyll --version
Scripts:
Mount the website's source directory into the container. Serve it using jekyll
gem.
docker run \
--interactive \
--rm \
--tty \
--volume $JEKYLL_SITE_DIR:/website:rw \
--workdir /website \
--publish 4444:4000 \
$DOCKER_IMAGE_NAME \
jekyll serve --watch --host 0.0.0.0
The website is now being served on http://localhost:4444/.
Scripts:
Analyze the website for duplicated and unused resources. Generate JUnit XML files as output, which can be parsed by other tools.
Run analysis locally directly from this repository.
ruby analyze.rb --source $JEKYLL_SITE_DIR
Run analysis rom Docker container.
docker run \
--rm \
--tty \
--volume $JEKYLL_SITE_DIR:/website:rw \
--workdir /website \
$DOCKER_IMAGE_NAME \
analyze \
--source /website \
--copies /opt/static-analysis/template_report_duplication.html \
--unused /opt/static-analysis/template_report_usage.html
Both of these commands will produce two reports in the current working directory.
Use ruby analyze.rb --help
command to view the complete list of available analyze options.
Scripts: