Update docker-image.yml
This commit is contained in:
parent
41f801129a
commit
da4e483d80
45
.github/workflows/docker-image.yml
vendored
45
.github/workflows/docker-image.yml
vendored
@ -1,39 +1,44 @@
|
|||||||
name: Build and push Docker image
|
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages
|
||||||
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- 'master'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
REGISTRY: ghcr.io
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
IMAGE_NAME: gpt-academic-nolocal
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# Checkout the repository
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# Configure Docker Buildx
|
- name: Log in to the Container registry
|
||||||
- name: Configure Docker Buildx
|
uses: docker/login-action@v2
|
||||||
run: |
|
with:
|
||||||
docker buildx create --name builder
|
registry: ${{ env.REGISTRY }}
|
||||||
docker buildx use builder
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Set up GitHub Packages registry
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
- name: Set up GitHub Packages registry
|
id: meta
|
||||||
run: echo "${DOCKER_PASSWORD}" | docker login ghcr.io -u "${DOCKER_USERNAME}" --password-stdin
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
# Build and push the Docker image
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: docs/DockerfileNoLocal
|
|
||||||
push: true
|
push: true
|
||||||
tags: ghcr.io/${{ github.repository }}/${{ env.IMAGE_NAME }}:latest
|
dockerfile: docs/Dockerfile+NoLocal
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user