Skip to content

Instantly share code, notes, and snippets.

@aussielunix
Created March 12, 2023 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aussielunix/fb63ea91309ce34d9ff53ee94dd961f2 to your computer and use it in GitHub Desktop.
Save aussielunix/fb63ea91309ce34d9ff53ee94dd961f2 to your computer and use it in GitHub Desktop.

Docsy dev

lunix@lumbergh]  (main) -> make
help                           This help.
start                          Run in local development mode
shell                          get a shell on your running dev environment
test                           Run unit testing
stop                           Stop a running dev environment
build                          Build Hugo site ready to be published
pub                            rsync to production
change                         create a new changelog entry
blog                           create a new blog post
re                             restart local dev
  • make start
  • edit files locally
  • make build
  • git commit changes
  • git push
---
version: "3.3"
services:
site:
image: docsy/docsy-example
build:
context: .
command: server --ignoreCache -D --noHTTPCache
ports:
- "1313:1313"
volumes:
- .:/src
build:
image: docsy/docsy-example
build:
context: .
#entrypoint: /bin/sh
command: -D -d site/ --cleanDestinationDir
volumes:
- .:/src
# HELP
# This will output the help for each task
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
RANDOM := $(shell /bin/bash -c "cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 6 | head -n 1")
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
ENV ?= local
start: ## Run in local development mode
@echo "Starting development server..."
@docker-compose up -d --build
@echo
@echo "run 'make stop' to shutdown your dev environment"
shell: ## get a shell on your running dev environment
@echo "This will give you a local shell in your dev environment"
@docker-compose exec dev bash
test: ## Run unit testing
@echo "This is the unit tests you should have..."
@echo "please implement me"
#@docker-compose exec dev npm run test
stop: ## Stop a running dev environment
@echo "Stopping your development environment"
@docker-compose down --remove-orphans
build: ## Build Hugo site ready to be published
@echo "Building site ready to be published"
@docker-compose run --rm build
pub: build ## rsync to production
@echo "Publishing to production (hdb)"
@rsync -avz --delete site/ my_droplet.digtialocean.com:sites/example.com/
change: ## create a new changelog entry
@echo "Creating a new changelog entry"
@docker-compose run build new content/en/changelog/2023/$(RANDOM).md
blog: ## create a new blog post
@echo "Creating a new blog post"
@docker-compose run build new content/en/blog/2023/$(RANDOM).md
re: stop start ## restart local dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment