Update Dockerfile #9
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 Push Docker Image | |
on: | |
push: | |
branches: | |
- main # 根据需要调整触发的分支 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. 检出代码 | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# 2. 设置 Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# 3. 登录 Docker Hub | |
- name: Log in to Docker Hub | |
uses: docker/#-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} # Docker Hub 用户名 | |
password: ${{ secrets.DOCKER_PASSWORD }} # Docker Hub 密码或令牌 | |
# 4. 构建 Docker 镜像 | |
- name: Build Docker image | |
run: | | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/iptv:latest . | |
# 5. 推送 Docker 镜像到 Docker Hub | |
- name: Push Docker image | |
run: | | |
docker push ${{ secrets.DOCKER_USERNAME }}/iptv:latest |