forked from sajosam/ecommerce-microservices
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (33 loc) · 1.14 KB
/
docker-ci.yml
File metadata and controls
41 lines (33 loc) · 1.14 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
37
38
39
40
41
name: Microservices CI/CD
on:
pull_request:
branches:
- main
push:
branches:
- main
env:
REGISTRY: docker.io
DOCKER_USERNAME: AlbinMathew2026
DOCKER_PASSWORD: AlbinM2906 # ⚠️ Avoid hardcoding credentials
IMAGE_PREFIX: iamsajo
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
service: [fastapi-order, flask-payment, golang-main, golang-user, nodejs-product]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Print Docker Username and Password (For Debugging)
run: |
echo "Docker Username: $DOCKER_USERNAME"
echo "Docker Password: $DOCKER_PASSWORD" # ⚠️ Be careful, this exposes the password in logs
- name: Login to Docker Hub
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- name: Build Docker Image
run: docker build -t $REGISTRY/$IMAGE_PREFIX/${{ matrix.service }}:latest ${{ matrix.service }}
- name: Push Docker Image (Only on Merge)
if: github.event_name == 'push'
run: docker push $REGISTRY/$IMAGE_PREFIX/${{ matrix.service }}:latest