Create docker-image.yml

This commit is contained in:
darefjev44 2024-04-20 13:27:03 +01:00 committed by GitHub
parent 85db0fca36
commit 2dda68827a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

42
.github/workflows/docker-image.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
#checkout repo
- uses: actions/checkout@v3
#build docker image
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
#login to github container registry
- name: Docker Login
uses: docker/login-action@v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
#get metadeta
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ghcr.io/${{ github.repository }}
#build/push to ghcr
- name: Build and push Docker images
uses: docker/build-push-action@v5.3.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}