Skip to content

feat(): 2.0.7定版 #28

feat(): 2.0.7定版

feat(): 2.0.7定版 #28

name: docker-build-push
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21.2'
- name: Get version from file
id: get_version
run: |
echo "version=$(cat version)" >> $GITHUB_ENV
- name: Build for amd64
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a --trimpath -ldflags="-w -s -X 'github.com/onlyLTY/dockerCopilotZspace/zspace/internal/config.Version=${{ env.version }}' -X 'github.com/onlyLTY/dockerCopilotZspace/zspace-DEV/internal/config.BuildDate=$(date)'" -o dist/linux/amd64/dockerCopilot .
- name: Build for arm64
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a --trimpath -ldflags="-w -s -X 'github.com/onlyLTY/dockerCopilotZspace/zspace/internal/config.Version=${{ env.version }}' -X 'github.com/onlyLTY/dockerCopilotZspace/zspace-DEV/internal/config.BuildDate=$(date)'" -o dist/linux/arm64/dockerCopilot .
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Docker Login
uses: docker/#-action@v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v5.0.0
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/dockercopilot:ZSPACE-DEV
push: true