Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add support for reproducible builds
  • Loading branch information
dmartinez committed May 2, 2024
1 parent 65edf60 commit a18d369
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Expand Up @@ -6,4 +6,5 @@ build
cypress*
Dockerfile
node_modules
output
README.md
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,6 +10,7 @@

# production
/build
/artifact/v*

# misc
.DS_Store
Expand Down
34 changes: 34 additions & 0 deletions Makefile
@@ -0,0 +1,34 @@
# This is the main interface into the repository for CI automation/reproducible builds.
#
# All targets assume they're running on a Linux or macOS host with Bash and Docker installed.
# Any other dependencies should be satisfied by containers.
#

.DEFAULT_GOAL := help

DEBUG = [DEBUG]
INFO = [INFO]
SUCCESS = [INFO]

CURRENT_UID := $(shell id -u)

compose := docker-compose

.PHONY: all
all: build

.PHONY: build
build: ## Build the static site from the container image
@echo "$(INFO) Building the wayfinder static site files"
$(compose) run --build -e CURRENT_UID=${CURRENT_UID} build-wayfinder
@echo "$(SUCCESS) Successfully built!"

.PHONY: clean
clean: ## Remove build artifacts
rm -f v*

.PHONY: help
help: ## Display this help (default)
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf " %-17s%s\n", $$1, $$2}'
1 change: 1 addition & 0 deletions VERSION.txt
@@ -0,0 +1 @@
1.0.0
Empty file added artifact/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions bin/zip_build.sh
@@ -0,0 +1,10 @@
#!/bin/sh

HOME_DIR=/usr/src/app
VERSION=v$(cat $HOME_DIR/VERSION.txt)

cd $HOME_DIR/build

tar -czvf $HOME_DIR/artifact/$VERSION.tar.gz *

chown $CURRENT_UID:$CURRENT_UID $HOME_DIR/artifact/$VERSION.tar.gz
12 changes: 12 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,12 @@
version: "3.8"

services:

build-wayfinder:
build:
context: "."
command: sh -c "npm run build && bin/zip_build.sh"
volumes:
- type: bind
source: ./artifact
target: /usr/src/app/artifact

0 comments on commit a18d369

Please sign in to comment.