Update docker-image.yml

This commit is contained in:
binary-husky 2023-05-07 15:44:44 +08:00 committed by GitHub
parent 4f0cd42117
commit b1154b368c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,18 +1,38 @@
name: Docker Image CI
name: Build and push Docker image
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
branches:
- main
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_NAME: example-image
jobs:
build:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag gpt-no-local-llms:$(date +%s)
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v2
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Set up GitHub Packages registry
- name: Set up GitHub Packages registry
run: |
echo "${DOCKER_PASSWORD}" | docker login ghcr.io -u "${DOCKER_USERNAME}" --password-stdin
# Build and push the Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: docs/Dockerfile+NoLocal
push: true
tags: ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}:latest