Test docker build & push. #4
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: 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: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest | |
# - name: Docker Build | |
# run: | | |
# cd examples/word-count | |
# docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest . | |
# - name: Docker Push | |
# run: | | |
# cd examples/word-count | |
# docker tag word-count:latest ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest | |
# docker push ${{ secrets.DOCKERHUB_USERNAME }}/word-count:latest |