chore: Add Jest for shopping cart service #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Docker Swarm | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: | |
[ | |
user-service, | |
product-service, | |
shopping-cart-service, | |
order-service, | |
payment-service, | |
notification-service, | |
] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./${{ matrix.service }} | |
file: ./${{ matrix.service }}/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{ matrix.service }}:latest | |
- name: Deploy to Docker Swarm | |
run: | | |
docker stack deploy -c docker-compose.yml ecommerce | |
- name: Logout from Docker Hub | |
run: docker logout |