Skip to content

Refactor Docker Build and Push #11

Refactor Docker Build and Push

Refactor Docker Build and Push #11

Workflow file for this run

name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-examples:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a set of commands using the runners shell
- name: Maven Package
run: |
cd examples/word-count
mvn clean package
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Docker Build & Push
run: |
cd examples/word-count
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest