mirror of
https://github.com/nikdoof/aaisp-chaos.git
synced 2025-12-13 06:42:16 +00:00
Add build infra
This commit is contained in:
5
.github/renovate.json
vendored
Normal file
5
.github/renovate.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
]
|
||||
}
|
||||
32
.github/workflows/build-docker-image.yaml
vendored
Normal file
32
.github/workflows/build-docker-image.yaml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
tags:
|
||||
- "[0-9]+.[0-9]+.[0-9]+"
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v1
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository_owner }}/aaisp-exporter:${{ github.ref_name }}
|
||||
ghcr.io/${{ github.repository_owner }}/aaisp-exporter:latest
|
||||
28
.github/workflows/release.yaml
vendored
Normal file
28
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
releases-matrix:
|
||||
name: Release Go Binary
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [linux, windows, darwin]
|
||||
goarch: ["386", amd64, arm64]
|
||||
exclude:
|
||||
- goarch: "386"
|
||||
goos: darwin
|
||||
- goarch: arm64
|
||||
goos: windows
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: wangyoucao577/go-release-action@v1.22
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
goos: ${{ matrix.goos }}
|
||||
goarch: ${{ matrix.goarch }}
|
||||
goversion: "https://dl.google.com/go/go1.17.4.linux-amd64.tar.gz"
|
||||
project_path: "./cmd/aaisp_exporter"
|
||||
binary_name: "aaisp_exporter"
|
||||
extra_files: LICENSE cmd/aaisp_exporter/README.md
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
aaisp_exporter
|
||||
15
Dockerfile
15
Dockerfile
@@ -1,7 +1,10 @@
|
||||
FROM alpine
|
||||
FROM golang:1.17.4-alpine3.15 as build
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN go get -d -v .
|
||||
RUN go build -v ./cmd/aaisp_exporter .
|
||||
|
||||
COPY cmd/aaisp_exporter/aaisp_exporter /usr/local/bin/aaisp_exporter
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/aaisp_exporter"]
|
||||
FROM alpine:3.15.0
|
||||
WORKDIR /service
|
||||
COPY --from=build /build/aaisp_exporter .
|
||||
ENTRYPOINT ["./aaisp_exporter"]%
|
||||
Reference in New Issue
Block a user