Skip to content

Remove sponsorship information #55

Remove sponsorship information

Remove sponsorship information #55

name: build docker image
on:
push:
branches:
- main
release:
types: [created, published] # 表示在创建新的 Release 时触发
# Allows you to run this workflow manually from the Actions tab
# 可以手动触发
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: true
default: "warning"
tags:
description: "Test scenario tags"
env:
DOCKERHUB_USERNAME: eryajf
ALIHUB_URL: registry.cn-hangzhou.aliyuncs.com
ALIHUB_USERNAME: eryajf
ALIHUB_IMAGE_REPONAME: eryajf
IMAGE_REPONAME: go-ldap-admin
jobs:
buildImage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v5
- name: Get current date
id: date
run: echo "today=$(date +'%Y%m%d-%H%M')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 设置go环境
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache-dependency-path: "go.sum"
- name: 安装 UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- run: go install github.com/authelia/gox@latest # setup gox
- run: |
docker cp $(docker create --rm docker.cnb.cool/opsre/go-ldap-admin-ui):/app/dist public/static/dist
make gox-linux
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE_REPONAME }}:buildcache
cache-to: type=registry,ref=${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE_REPONAME }}:buildcache,mode=max
platforms: linux/amd64,linux/arm64
tags: |
${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE_REPONAME }}:latest
${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE_REPONAME }}:${{ env.GITHUB_REF_NAME }}
${{ env.DOCKERHUB_USERNAME }}/${{ env.IMAGE_REPONAME }}:${{ steps.date.outputs.today }}
ghcr.io/${{ github.repository }}
ghcr.io/${{ github.repository }}:${{ env.GITHUB_REF_NAME }}
ghcr.io/${{ github.repository }}:${{ steps.date.outputs.today }}