Skip to content

Workflow file for this run

name: AskTable Docs Docker Image
on:
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Aliyun Docker Registry
run: echo ${{ secrets.ALIYUN_DOCKER_REGISTRY_PASSWORD }} | docker login --username=${{ secrets.ALIYUN_DOCKER_REGISTRY_USER }} --password-stdin registry.cn-shanghai.aliyuncs.com
# Parse the version from github.ref (e.g., refs/tags/v1.0.0 => v1.0.0)
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build, tag and push Docker image
uses: docker/[email protected]
with:
context: at-docs-website # 作为上下文
file: at-docs-website/Dockerfile # Dockerfile的位置
push: true # 推送镜像到阿里云镜像仓库
tags: |
registry.cn-shanghai.aliyuncs.com/datamini/asktable-docs:latest
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64
- name: Execute deployment script # 只更新、重启,不提供 docker-compose.yaml 文件
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_HOST_SH4 }}
username: ${{ secrets.SERVER_USER }}
password: ${{ secrets.SERVER_PASSWORD }}
port: 22
script: |
# 进入部署目录
cd /root/sh4/at-docs/
# 拉取最新镜像
docker-compose pull && docker-compose down
# 启动容器
docker-compose up -d