Skip to content

Create docker-image.yml #1

Create docker-image.yml

Create docker-image.yml #1

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker image
run: |
TAG=${{ github.ref_name }}-${{ github.run_number }}
docker build \
--file Dockerfile \
--tag my-image-name:${TAG} \
--tag my-image-name:latest .
docker push my-image-name:${TAG}
docker push my-image-name:latest