mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 05:32:02 +08:00
62 lines
1.3 KiB
YAML
62 lines
1.3 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'Makefile'
|
|
- 'config.json'
|
|
branches:
|
|
- 'master'
|
|
|
|
env:
|
|
IMAGE_NAME: webp-server-go
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.23'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libvips-dev
|
|
|
|
- name: Build for amd64
|
|
run: |
|
|
GOOS=linux GOARCH=amd64 go build -o builds/webp-server-linux-amd64 .
|
|
|
|
- name: Build for arm64
|
|
run: |
|
|
GOOS=linux GOARCH=arm64 go build -o builds/webp-server-linux-arm64 .
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: woodchen
|
|
password: ${{ secrets.ACCESS_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: Dockerfile.multi
|
|
push: true
|
|
tags: woodchen/${{ env.IMAGE_NAME }}:latest
|
|
platforms: linux/amd64,linux/arm64
|
|
|