Skip to content

Instantly share code, notes, and snippets.

@nothub
Created August 6, 2022 12:03
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 nothub/f0ecbfab8c3f237e7f661d9c7a7d4c78 to your computer and use it in GitHub Desktop.
Save nothub/f0ecbfab8c3f237e7f661d9c7a7d4c78 to your computer and use it in GitHub Desktop.
develop svelte (and other node crap) in containers
help:
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# test build requirements
REQUIRED_BINS := podman
$(foreach bin,$(REQUIRED_BINS),\
$(if $(shell command -v $(bin) 2> /dev/null),$(),$(error please install missing build requirement: `$(bin)`)))
.ONESHELL:
# this will be evaluated to set the shell, even when not called explicitly
shell: $(eval SHELL:=/bin/bash)
all: help
deps: ## install dependencies
cd frontend && \
podman run \
--interactive \
--tty \
--rm \
--volume .:/work \
--workdir /work \
docker.io/library/node:16 \
npm install
run: deps ## run development server
cd frontend && \
podman run \
--interactive \
--tty \
--rm \
--volume .:/work \
--workdir /work \
--env HOST=0.0.0.0 \
--publish 127.0.0.1:5000:5000 \
docker.io/library/node:16 \
npm run dev
build: deps ## build production site
cd frontend && \
podman run \
--interactive \
--tty \
--rm \
--volume .:/work \
--workdir /work \
docker.io/library/node:16 \
npm run build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment