更新 HEALTHCHECK #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Docker Image | |
# refer to https://github.com/actions/starter-workflows/blob/main/ci/docker-publish.yml | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the master branch | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
environment: docker | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Login against a Docker registry except on PR | |
# https://github.com/docker/login-action | |
- name: Log into registry | |
# if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Prepare environment variables | |
id: env | |
run: | | |
IMAGE_NAME=$(echo $GITHUB_REPOSITORY | sed "s#${GITHUB_REPOSITORY_OWNER}/docker-##") | |
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_OUTPUT | |
TIME=$(TZ=Asia/Shanghai date +"%Y%m%d-%H%M%S") | |
echo "TIME=${TIME}" >> $GITHUB_OUTPUT | |
- name: Update Docker Hub Description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
repository: ${{ secrets.DOCKER_HUB_USER }}/${{ steps.env.outputs.IMAGE_NAME }} | |
readme-filepath: README.md | |
# Build and push Docker image with Buildx | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: . | |
tags: | | |
${{ secrets.DOCKER_HUB_USER }}/${{ steps.env.outputs.IMAGE_NAME }} | |
${{ secrets.DOCKER_HUB_USER }}/${{ steps.env.outputs.IMAGE_NAME }}:${{ steps.env.outputs.TIME }} |