-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
36 lines (30 loc) · 1.33 KB
/
makefile
File metadata and controls
36 lines (30 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
CURRENT_VERSION=$(shell grep '^version' pyproject.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
DOCKER_IMAGE_NAME=dataesr/flash-rag
CONTAINER_NAME=flash-rag
GHCR_IMAGE_NAME=ghcr.io/$(DOCKER_IMAGE_NAME)
build:
@echo "Building Docker image $(GHCR_IMAGE_NAME):$(CURRENT_VERSION)"
docker build -t $(GHCR_IMAGE_NAME):$(CURRENT_VERSION) -t $(GHCR_IMAGE_NAME):latest .
@echo "Docker image $(GHCR_IMAGE_NAME):$(CURRENT_VERSION) built successfully"
push:
@echo "Pushing Docker image $(GHCR_IMAGE_NAME):$(CURRENT_VERSION)"
docker push $(GHCR_IMAGE_NAME):$(CURRENT_VERSION)
docker push $(GHCR_IMAGE_NAME):latest
@echo "Docker image $(GHCR_IMAGE_NAME):$(CURRENT_VERSION) pushed successfully"
run:
@echo "Running Docker image $(GHCR_IMAGE_NAME):$(CURRENT_VERSION)"
docker run -p 8000:8000 -d --env-file .env -v ./data:/app/data --name $(CONTAINER_NAME) $(GHCR_IMAGE_NAME):$(CURRENT_VERSION)
stop:
@echo "Stopping Docker image $(GHCR_IMAGE_NAME):$(CURRENT_VERSION)"
docker stop $(CONTAINER_NAME)
build-push:
@"$(MAKE)" build
@"$(MAKE)" push
release:
ifndef VERSION
$(error VERSION is not defined. Use 'make release VERSION=x.y.z')
endif
sed -i 's/^version = ".*"/version = "${VERSION}"/' pyproject.toml
git commit -am '[release] version ${VERSION}'
git tag v${VERSION}
@echo "If everything is OK, you can push with tags i.e. git push origin main --tags"