Skip to content

Build and push to Docker Hub #743

Build and push to Docker Hub

Build and push to Docker Hub #743

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Build and push to Docker Hub
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: ["*"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
intera/ci-cypress
intera/docker-ci-cypress
# generate Docker tags based on the following events/attributes
tags: |
type=raw,priority=700,value=latest,enable={{ is_default_branch }}
type=ref,event=branch
- name: Log in to Docker Hub
# Uses v2.1.0, sha1 is used for better security
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: |
${{ steps.meta.outputs.tags }}
intera/ci-cypress:local
- name: Verify Cypress
run: |
docker run --rm -v "$(pwd)/verify.sh":/opt/verify.sh intera/ci-cypress:local bash /opt/verify.sh
- name: Push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}