Skip to content

Commit

Permalink
Create docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
caovc authored Oct 9, 2024
1 parent d88f593 commit 55b4b0a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

# 设置 Docker Hub 凭证为环境变量
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin

- name: Build the Docker image
run: docker build . --file Dockerfile --tag devdocs:latest

# 将镜像推送到 Docker Hub
- name: Push Docker image to Docker Hub
run: |
docker tag devdocs:latest ${{ secrets.DOCKERHUB_USERNAME }}/devdocs:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/devdocs:latest

0 comments on commit 55b4b0a

Please sign in to comment.