Skip to content

Commit

Permalink
build: add docker support for local testing
Browse files Browse the repository at this point in the history
this should build and start a local jekyll+github server to test changes
locally (only tested on linux)

% docker compose build --pull
% docker compose up -d

hopefully the Gemfile doesn't muck with the GH Pages deployment or we'll
need to put it somewhere else e.g., `.deploy/`
  • Loading branch information
alee committed Dec 5, 2024
1 parent 3203335 commit a0ae344
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,27 @@ $RECYCLE.BIN/

# Things specific to this directory.
# .............................................................................

# Jekyll / Ruby things
### Jekyll ###
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata
# Ignore folders generated by Bundler
.bundle/
vendor/

### Ruby ###
*.gem
*.rbc
Gemfile.lock
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM ruby:3-bookworm

ENV SETUPDIR=/setup
WORKDIR ${SETUPDIR}
ARG GEMFILE_DIR=.
COPY $GEMFILE_DIR/Gemfile* $GEMFILE_DIR/packages* ./

# Install build dependencies
RUN set -eux; \
apt update && \
apt upgrade -y

# Install Bundler
RUN set -eux; gem install bundler

# Install gems from `Gemfile` via Bundler
RUN set -eux; bundler install

# Remove build dependencies
RUN set -eux; apt clean

# Clean up
WORKDIR /srv/jekyll
RUN set -eux; \
rm -rf \
${SETUPDIR} \
/usr/gem/cache \
/root/.bundle/cache \
;

EXPOSE 4000
ENTRYPOINT ["bundle", "exec", "jekyll"]
CMD ["--version"]
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "github-pages", "~> 232", group: :jekyll_plugins
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
remote_theme: pages-themes/[email protected]
title: SciCodes Collaboration Workshop
description: A Sloan Foundation-funded workshop for editors & maintainers of academic discipline & institutional software registries & repositories
repository: SciCodes/workshop-2025
plugins:
- jekyll-remote-theme
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
site:
build: .
image: scicodes-2025-site:latest
entrypoint: ["bundle", "exec", "jekyll", "serve", "--host=0.0.0.0", "--incremental"]
ports:
- 4000:4000
volumes:
- .:/srv/jekyll:Z
- ./vendor/bundle:/usr/local/bundle:Z

0 comments on commit a0ae344

Please sign in to comment.