Skip to content

Commit 0854a7d

Browse files
committed
build(docker): add makefile for image build and clean
1 parent 479ceea commit 0854a7d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
IMAGE ?= opencode-cli
2+
TAG ?= dev
3+
IMAGE_REF := $(IMAGE):$(TAG)
4+
DOCKERFILE ?= Dockerfile
5+
CONTEXT ?= .
6+
OPENCODE_VERSION ?= latest
7+
8+
.PHONY: build clean
9+
10+
build:
11+
docker build \
12+
-t $(IMAGE_REF) \
13+
-f $(DOCKERFILE) \
14+
--build-arg OPENCODE_VERSION=$(OPENCODE_VERSION) \
15+
$(CONTEXT)
16+
17+
clean:
18+
@echo "Removing image $(IMAGE_REF) if it exists..."
19+
- docker image inspect $(IMAGE_REF) >/dev/null 2>&1 && docker rmi $(IMAGE_REF) || true

0 commit comments

Comments
 (0)