Skip to content

Commit 5f01821

Browse files
committed
push to dockerhub_dev_and_main
1 parent c2a74a4 commit 5f01821

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

.github/workflows/main.yaml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: miniCRM workflow
22

33
on:
44
push:
5-
branches: [ dev ]
5+
branches:
6+
- '**'
67

78
jobs:
89
lint:
@@ -34,10 +35,13 @@ jobs:
3435
run: |
3536
flake8 . --count --statistics --show-source
3637
37-
build_and_push_to_docker_hub:
38-
name: miniCRM Push Docker Image to Docker Hub
38+
push_branch_dev_to_docker_hub:
39+
name: Build and Push Docker (dev)
3940
runs-on: ubuntu-latest
4041
needs: lint
42+
43+
if: github.ref == 'refs/heads/dev'
44+
4145
steps:
4246
- name: Check out the repo
4347
uses: actions/checkout@v4
@@ -56,3 +60,29 @@ jobs:
5660
push: true
5761
tags: |
5862
dmsn/minicrm:dev
63+
64+
push_branch_main_to_docker_hub:
65+
name: Build and Push Docker (prod)
66+
runs-on: ubuntu-latest
67+
needs: lint
68+
69+
if: github.ref == 'refs/heads/main'
70+
71+
steps:
72+
- name: Check out the repo
73+
uses: actions/checkout@v4
74+
75+
- name: Setup Docker Buildx
76+
uses: docker/setup-buildx-action@v3
77+
78+
- name: Login to Docker
79+
uses: docker/login-action@v3
80+
with:
81+
username: ${{ secrets.DOCKER_USERNAME }}
82+
password: ${{ secrets.DOCKER_PASSWORD }}
83+
- name: Push to Docker Hub
84+
uses: docker/build-push-action@v5
85+
with:
86+
push: true
87+
tags: |
88+
dmsn/minicrm:prod

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
env_file:
1111
- ./.env
1212
backend:
13-
image: dmsn/minicrm:latest
13+
image: dmsn/minicrm:${{IMAGE_TAG}}
1414
restart: always
1515
depends_on:
1616
- db

0 commit comments

Comments
 (0)