Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ If you'd like to edit a specific devopsdays event site (and/or contribute code),
1. Start docker
1. Run `./hugoserver.sh` from the root of this repo.

#### Run Hugo using docker compose

1. Start your containerisation engine (Colima, Docker, etc.)
1. Run `make docker-server` from the root of this repo.

Hugo and Node versions are read automatically from `.github/workflows/hugo.yml`.

#### Run Hugo locally

1. Install [Hugo](http://gohugo.io). Use the Hugo version that we use in [.github/workflows/hugo.yml](https://github.com/devopsdays/devopsdays-web/blob/main/.github/workflows/hugo.yml) file. [(Quick Install)](https://gohugo.io/getting-started/installing#binary-cross-platform)
Expand Down
46 changes: 27 additions & 19 deletions makefile

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also stripped the Windows-style line endings from this file, which is why every line has been modified.

Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
.PHONY: deps build server clean

# Copy dependencies from node_modules to assets
deps:
./utilities/build-scripts/copy-scss-deps.sh
./utilities/build-scripts/copy-js-deps.sh

# Build the site
build: deps
hugo

# Run the development server
server: deps
hugo server

# Clean up generated files
clean:
rm -rf public/
rm -rf resources/
.PHONY: deps build server clean docker-server

HUGO_VERSION := $(shell grep 'HUGO_VERSION:' .github/workflows/hugo.yml | sed 's/.*: //')
NODE_VERSION := $(shell grep 'NODE_VERSION:' .github/workflows/hugo.yml | sed 's/.*: //')

# Copy dependencies from node_modules to assets
deps:
./utilities/build-scripts/copy-scss-deps.sh
./utilities/build-scripts/copy-js-deps.sh

# Build the site
build: deps
hugo

# Run the development server
server: deps
hugo server

# Run the development server via Docker (versions sourced from .github/workflows/hugo.yml)
docker-server:
NODE_VERSION=$(NODE_VERSION) HUGO_VERSION=$(HUGO_VERSION) \
docker compose -f utilities/contrib/docker-compose.yml up

# Clean up generated files
clean:
rm -rf public/
rm -rf resources/
19 changes: 19 additions & 0 deletions utilities/contrib/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# docker compose -f utilities/contrib/docker-compose.yml up
services:
hugo:
build:
dockerfile: ../../.devcontainer/Dockerfile
args:
NODE_VERSION: "${NODE_VERSION:?NODE_VERSION must be set - run via make docker-server}"
VARIANT: hugo_extended
VERSION: "${HUGO_VERSION:?HUGO_VERSION must be set - run via make docker-server}"
working_dir: /workspace
volumes:
- ../../:/workspace
- node_modules:/workspace/node_modules
ports:
- "1313:1313"
command: sh -c "npm install && make deps && hugo server --bind 0.0.0.0 --poll 1s"

volumes:
node_modules:
Loading