Skip to content

Commit

Permalink
ci: improve CI/CD workflow for Docker image deployment
Browse files Browse the repository at this point in the history
- Add a `main` branch to trigger the workflow
- Add a step to build and push a Docker image
- Update Docker image push command to include image name and version

Signed-off-by: Sean Zheng <[email protected]>
  • Loading branch information
blackhorseya committed Jul 29, 2024
1 parent 6c62681 commit d8622e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- '*'
branches:
- main

jobs:
build:
Expand All @@ -30,6 +32,10 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Docker Image
run: |-
make docker-push
create-release:
runs-on: ubuntu-latest
permissions:
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ test-load: ## test stress
@#k6 run --env SCENARIO=average_load ./tests/k6/order.api.test.js --out=cloud

## docker
IMAGE_NAME := ghcr.io/blackhorseya/$(PROJECT_NAME)

.PHONY: docker-push
docker-push: ## push docker image
## docker push $(PROJECT_NAME):$(VERSION)
@echo "Pushing Docker image to $(IMAGE_NAME):$(VERSION)"
docker buildx build --push \
--tag $(IMAGE_NAME):latest \
--tag $(IMAGE_NAME):$(VERSION) .

## deployments
DEPLOY_TO := prod
Expand Down

0 comments on commit d8622e4

Please sign in to comment.