new example

This commit is contained in:
Ray Lyon
2022-04-05 20:22:37 -04:00
committed by GitHub
parent 4f16c9869d
commit b54686e8cd

View File

@@ -1,28 +1,40 @@
name: Docker Image CI name: Create and publish a Docker image
on: on:
push: push:
branches: [ main ] branches: ['main']
pull_request:
branches: [ main ] env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
build-and-push-image:
build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
env:
github_pat: ${{ secrets.CONTAINER_PAT }} - name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_PAT }}
- name: Extract metadata (tags, labels) for Docker
- name: Build the Docker image id: meta
run: docker build . --file Dockerfile --tag telegram-moviebot:$(date +%s) uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
- name: Authenticate to the container registry images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
run: echo $github_pat | docker login ghcr.io -u skoobasteeve --password-stdin
- name: Build and push Docker image
- name: Push the image to container registry uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
run: docker push ghcr.io/skoobasteeve/telegram-moviebot:latest with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}