Skip to content

Build and Publish Docker Image #1

Build and Publish Docker Image

Build and Publish Docker Image #1

name: Build and Publish Docker Image
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/jf-sleep-timer:latest
${{ secrets.DOCKER_USERNAME }}/jf-sleep-timer:${{ github.sha }}
- name: Log out of Docker Hub
run: docker logout