dockerfile change #12
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: Docker Image CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: load source code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: | | |
npm install # Replace with your package manager if needed (e.g., yarn install) | |
ls | |
pwd | |
- name: Build project # Add your specific build command here (e.g., npm run build) | |
run: npm run build | |
- name: Login to Aliyun Container Registry (ACR) | |
uses: aliyun/acr-login@v1 # 使用阿里云镜像服务action | |
with: | |
login-server: registry.cn-zhangjiakou.aliyuncs.com | |
region-id: cn-zhangjiakou | |
username: "${{ secrets.REGISTRY_USERNAME }}" | |
password: "${{ secrets.REGISTRY_PASSWORD }}" | |
- name: Build and Push Docker Image | |
env: | |
IMAGE_TAG: ${{ github.sha }} # 用于标记容器版本号 | |
run: | | |
docker build -t registry.cn-zhangjiakou.aliyuncs.com/homek8s/mtt-assistant:$IMAGE_TAG . | |
docker push registry.cn-zhangjiakou.aliyuncs.com/homek8s/mtt-assistant:$IMAGE_TAG |