Skip to content

Commit

Permalink
Added justfile target for performing local docker builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
sflanker committed Sep 3, 2024
1 parent 8e845a7 commit d4205b1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
INSTALL_DIR := env('INSTALL_DIR', '/usr/local/bin')
IMAGE_NAME := "ghcr.io/easy-up/portage"

# build portage binary
build-exp:
Expand All @@ -14,6 +15,13 @@ build:
mkdir -p bin
go build -ldflags="-X 'main.cliVersion=$(git describe --tags)' -X 'main.gitCommit=$(git rev-parse HEAD)' -X 'main.buildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ)' -X 'main.gitDescription=$(git log -1 --pretty=%B)'" -o ./bin ./cmd/portage

# build docker image for local use
docker-build-local:
if ! git diff-index --quiet HEAD; then \
echo "WARNING: uncommitted changes incorporated into local docker image" >&2; \
fi
docker build . --build-arg VERSION=local-$(git show --no-patch HEAD --format='%h') --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg GIT_DESCRIPTION="$(git show --no-patch HEAD --format='%s')" -t "{{IMAGE_NAME}}:local-$(git show --no-patch HEAD --format='%h')"

# build and install binary
install: build
cp ./bin/portage {{ INSTALL_DIR }}/portage
Expand All @@ -33,4 +41,4 @@ upgrade:

# Locally serve documentation
serve-docs:
mdbook serve
mdbook serve

0 comments on commit d4205b1

Please sign in to comment.