Skip to content

Build and push microservices #19

Build and push microservices

Build and push microservices #19

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build and push microservices
on:
#push:
# tags:
# - '*'
workflow_dispatch:
jobs:
build-customer:
runs-on: ubuntu-latest
defaults:
run:
working-directory: labs/02-eCommerce_microservices/customer
steps:
- uses: actions/checkout@v2
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 customer-mongodb order-postgres kafka" | sudo tee -a /etc/hosts
- name: Get branch
id: get_branch
run: echo ::set-output name=BRANCH::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Get the commit SHA
id: get_commit_sha
run: echo ::set-output name=COMMIT_SHA::$(git rev-parse --short "$GITHUB_SHA")
- name: Build and push Docker image
uses: docker/[email protected]
with:
path: labs/02-eCommerce_microservices/customer/
dockerfile: labs/02-eCommerce_microservices/customer/Dockerfile
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/customer
tags: ${{ steps.get_commit_sha.outputs.COMMIT_SHA }}-${{ steps.get_branch.outputs.BRANCH }}, latest
build_args: |
TAG=${{ steps.get_commit_sha.outputs.COMMIT_SHA }}-${{ steps.get_branch.outputs.BRANCH }}
add-hosts:
- customer-mongodb:127.0.0.1

Check failure on line 42 in .github/workflows/build-docker-images.yaml

View workflow run for this annotation

GitHub Actions / Build and push microservices

Invalid workflow file

The workflow is not valid. .github/workflows/build-docker-images.yaml (Line: 42, Col: 11): A sequence was not expected

Check failure on line 42 in .github/workflows/build-docker-images.yaml

View workflow run for this annotation

GitHub Actions / Build and push microservices

Invalid workflow file

The workflow is not valid. .github/workflows/build-docker-images.yaml (Line: 42, Col: 11): A sequence was not expected
- order-postgres:127.0.0.1
- kafka:127.0.0.1
build-order:
runs-on: ubuntu-latest
defaults:
run:
working-directory: labs/02-eCommerce_microservices/order
steps:
- uses: actions/checkout@v2
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 customer-mongodb order-postgres kafka" | sudo tee -a /etc/hosts
- name: Get branch
id: get_branch
run: echo ::set-output name=BRANCH::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Get the commit SHA
id: get_commit_sha
run: echo ::set-output name=COMMIT_SHA::$(git rev-parse --short "$GITHUB_SHA")
- name: Build and push Docker image
uses: docker/[email protected]
with:
path: labs/02-eCommerce_microservices/order/
dockerfile: labs/02-eCommerce_microservices/order/Dockerfile
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/order
tags: ${{ steps.get_commit_sha.outputs.COMMIT_SHA }}-${{ steps.get_branch.outputs.BRANCH }}, latest
build_args: |
TAG=${{ steps.get_commit_sha.outputs.COMMIT_SHA }}-${{ steps.get_branch.outputs.BRANCH }}
build-notification:
runs-on: ubuntu-latest
defaults:
run:
working-directory: labs/02-eCommerce_microservices/notification
steps:
- uses: actions/checkout@v2
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 customer-mongodb order-postgres kafka" | sudo tee -a /etc/hosts
- name: Get branch
id: get_branch
run: echo ::set-output name=BRANCH::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Get the commit SHA
id: get_commit_sha
run: echo ::set-output name=COMMIT_SHA::$(git rev-parse --short "$GITHUB_SHA")
- name: Build and push Docker image
uses: docker/[email protected]
with:
path: labs/02-eCommerce_microservices/notification/
dockerfile: labs/02-eCommerce_microservices/notification/Dockerfile
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/notification
tags: ${{ steps.get_commit_sha.outputs.COMMIT_SHA }}-${{ steps.get_branch.outputs.BRANCH }}, latest
build_args: |
TAG=${{ steps.get_commit_sha.outputs.COMMIT_SHA }}-${{ steps.get_branch.outputs.BRANCH }}