Skip to content

Docker Build and Push Comment #5

Docker Build and Push Comment

Docker Build and Push Comment #5

name: Docker Build and Push Comment
on:
workflow_dispatch:
inputs:
parameter_name:
description: 'go'
required: true
jobs:
# comment-rpc
build-and-push-comment-rpc:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Create and push comment-rpc Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./server/comment/rpc/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_IMAGE }}comment-rpc:latest
platforms: linux/amd64,linux/arm64 # 构建多个架构的镜像
- name: executing remote ssh commands using password
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cd /home/douniu
docker-compose.yaml stop comment-rpc
docker-compose.yaml rm -f comment-rpc
docker image rm ${{ secrets.DOCKERHUB_IMAGE }}comment-rpc:latest
docker-compose -f docker-compose.yaml up -d comment-rpc
# comment-api
build-and-push-comment-api:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Create and push comment-api Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./server/comment/api/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_IMAGE }}comment-api:latest
platforms: linux/amd64,linux/arm64 # 构建多个架构的镜像
- name: executing remote ssh commands using password
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cd /home/douniu
docker-compose stop comment-api
docker-compose rm -f comment-api
docker image rm ${{ secrets.DOCKERHUB_IMAGE }}comment-api:latest
docker-compose -f docker-compose.yaml up -d comment-api