Skip to content

Instantly share code, notes, and snippets.

@fowlmouth
Last active January 14, 2023 19:13
Show Gist options
  • Save fowlmouth/c24a20fa284b4b688aa1edde956ca441 to your computer and use it in GitHub Desktop.
Save fowlmouth/c24a20fa284b4b688aa1edde956ca441 to your computer and use it in GitHub Desktop.
nanoc site deployment skeleton

nanoc skeleton project

Put source code in ./site/

Initializing a new site directory

mkdir -p site/
docker run \
  --volume "$PWD/site:/site" \
  --workdir /site \
  --entrypoint sh
  docker.io/library/ruby:3.2 \
  -c "gem install nanoc && nanoc create-site ."
source 'https://rubygems.org'
gem 'nanoc'
gem 'webrick'
gem 'adsf'
group 'nanoc' do
gem 'nanoc-live'
gem 'kramdown'
end
DEV_IMAGE_TAG := nanoc-dev
RELEASE_IMAGE_TAG := docker.io/fowlmouth/nanoc-site:latest
dev-container:
docker build . --file nanoc.Dockerfile --tag "$(DEV_IMAGE_TAG)" --target build
release-container:
docker build . --file nanoc.Dockerfile --tag "$(RELEASE_IMAGE_TAG)"
dev: dev-container
docker run --interactive --tty \
--volume "$(PWD)/site:/site" --workdir /site \
--publish '33000:3000' \
"$(DEV_IMAGE_TAG)" \
bundler exec nanoc live --host 0.0.0.0
FROM docker.io/library/ruby:3.2 AS build
ADD Gemfile* ./
RUN bundle install
WORKDIR /src
ADD site/ ./
RUN bundler exec nanoc compile
FROM docker.io/library/nginx:1.21 AS main
COPY --from=build /src/output /usr/share/nginx/html/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment