Skip to content

build

build #5

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
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
shell: bash
- name: Login Docker Hub
uses: docker/login-action@master
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push Docker
shell: bash
run: |
NAME=ddns
DIST=dist
DOCKER_REGISTRY=gitsang
VERSION=${{ steps.get_version.outputs.VERSION }}
CGO_ENABLED=0 go build -o ${DIST}/${NAME} ./cmd
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/arm/v8,linux/ppc64le,linux/s390x,linux/386 \
--no-cache \
--build-arg DIST=${DIST} \
-t ${DOCKER_REGISTRY}/${NAME}:${VERSION} \
-f Dockerfile \
--push .