Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI

on:
pull_request:
push:
branches:
- trunk
tags:
- "v*"

env:
GO_VERSION: "1.25"

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Check out code
uses: actions/checkout@v3
- name: Run tests
run: go test ./...

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Check out code
uses: actions/checkout@v3
- name: Build
run: go build -v ./...

build-and-push-images:
name: Build and push images
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
latest
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
27 changes: 24 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
FROM debian:9.9-slim
# Builder stage
FROM golang:1.25.1-bookworm AS builder

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN go test ./...

# Build the binary
RUN CGO_ENABLED=0 go build -o /app/mikrotik-exporter .

# Final stage
FROM debian:12.12-slim

WORKDIR /app

EXPOSE 9436

# Copy the binary from the builder stage
COPY --from=builder /app/mikrotik-exporter /app/mikrotik-exporter

# Copy the start.sh script
COPY scripts/start.sh /app/
COPY dist/mikrotik-exporter_linux_amd64 /app/mikrotik-exporter

RUN chmod 755 /app/*

ENTRYPOINT ["/app/start.sh"]
ENTRYPOINT ["/app/start.sh"]
8 changes: 0 additions & 8 deletions Dockerfile.arm64

This file was deleted.

10 changes: 0 additions & 10 deletions Dockerfile.armhf

This file was deleted.

2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Config struct {
Ipsec bool `yaml:"ipsec,omitempty"`
Lte bool `yaml:"lte,omitempty"`
Netwatch bool `yaml:"netwatch,omitempty"`
Cloud bool `yaml:"netwatch,omitempty"`
Cloud bool `yaml:"cloud,omitempty"`
} `yaml:"features,omitempty"`
}

Expand Down