62 lines
1.2 KiB
YAML
62 lines
1.2 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build:
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
cache:
|
|
dir: ""
|
|
host: "10.16.0.5"
|
|
port: 8088
|
|
runs-on: [label-one]
|
|
container:
|
|
image: liffsh/dind
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Login to Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
/root/go/pkg/mod
|
|
/root/go/bin
|
|
/root/.cache/go-build
|
|
key: go-mod-{{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
go-mod-
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: '1.25.1'
|
|
|
|
# Download modules
|
|
- name: Go mod tidy
|
|
run: go mod tidy
|
|
|
|
- name: ls
|
|
run:
|
|
ls
|
|
|
|
- name: Build Docker Image
|
|
env:
|
|
BRANCH_NAME: ${{ github.ref_name }}
|
|
SHORT_HASH: ${{ github.sha }}
|
|
run: |
|
|
docker build .
|
|
|
|
- name: Push
|
|
run:
|
|
docker push liffsh/lilog:latest
|
|
|