Skip to content

build

build #12

Workflow file for this run

name: docker
on:
create:
tags:
- v*
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Get Version
id: get_version
shell: bash
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Login Docker Hub
uses: docker/login-action@master
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
shell: bash
run: |
CGO_ENABLED=0 go build -o dist/ddns ./cmd
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: gitsang/ddns:latest,gitsang/ddns:${{ steps.get_version.outputs.VERSION }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: DIST=dist
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache