Skip to content

docker

docker #6

Workflow file for this run

name: docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
workflow_dispatch:
push:
branches:
- main
paths:
- scripts
- .github/workflows/dockerfile.yaml
env:
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: false
repository: MaaAssistantArknights/containers
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry
uses: docker/login-action@v3
with:
registry: harbor.maa-org.net
username: ${{ secrets.MAA_HARBOR_ROBOT_USERNAME }}
password: ${{ secrets.MAA_HARBOR_ROBOT_PASSWORD }} # 每 30 天更新一次
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: harbor.maa-org.net/maa/MaaS3Jenkins-base
tags: |
type=raw,value=latest
type=sha,format=long,prefix={{date 'Y-MM-DDTHH-mm-ss[Z]'}}_
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
file: dockerfile/MaaS3Jenkins-base/Dockerfile
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
push: true