增加docker部署方式 #7
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镜像 | |
on: | |
schedule: | |
- cron: "00 12 * * 0" | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
watch: | |
types: started | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: akile monitor server meta | |
id: server_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKER_USERNAME }}/akile_monitor_server | |
tags: | | |
type=raw,value=latest | |
{{date 'YYYY/MM/DD/hh/mm/ss'}} | |
- name: akile monitor frontend meta | |
id: fe_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKER_USERNAME }}/akile_monitor_fe | |
tags: | | |
type=raw,value=latest | |
{{date 'YYYY/MM/DD/hh/mm/ss'}} | |
- name: akile monitor client meta | |
id: client_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKER_USERNAME }}/akile_monitor_client | |
tags: | | |
type=raw,value=latest | |
{{date 'YYYY/MM/DD/hh/mm/ss'}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push server | |
id: docker_build_server | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
target: server | |
tags: ${{ steps.server_meta.outputs.tags }} | |
labels: ${{ steps.server_meta.outputs.labels }} | |
- name: server Image digest | |
run: echo ${{ steps.docker_build_server.outputs.digest }} | |
- name: Build and push frontend | |
id: docker_build_fe | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
target: fe | |
tags: ${{ steps.fe_meta.outputs.tags }} | |
labels: ${{ steps.fe_meta.outputs.labels }} | |
- name: fe Image digest | |
run: echo ${{ steps.docker_build_fe.outputs.digest }} | |
- name: Build and push client | |
id: docker_build_client | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
target: client | |
tags: ${{ steps.client_meta.outputs.tags }} | |
labels: ${{ steps.client_meta.outputs.labels }} | |
- name: client Image digest | |
run: echo ${{ steps.docker_build_client.outputs.digest }} |