Skip to content

Commit ccf6f12

Browse files
committed
Fix CI
1 parent b2045c2 commit ccf6f12

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
registry: ghcr.io
4444
username: ${{ github.actor }}
4545
password: ${{ secrets.GITHUB_TOKEN }}
46+
- name: Get current date and time
47+
id: date
48+
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M')"
4649
- name: Build and push
4750
id: docker_build
4851
uses: docker/build-push-action@v3
@@ -52,6 +55,8 @@ jobs:
5255
platforms: linux/amd64,linux/arm64
5356
build-args: |
5457
VERSION=${{github.ref_name}}
58+
COMMIT=${{github.sha}}
59+
DATE=${{ steps.date.outputs.date }}
5560
tags: ${{ steps.meta.outputs.tags }}
5661
labels: ${{ steps.meta.outputs.labels }}
5762
push: ${{ github.event_name != 'pull_request' }}

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# syntax = docker/dockerfile:1.3-labs
2+
3+
ARG VERSION=0.0.0
4+
ARG COMMIT=''
5+
ARG DATE=''
6+
7+
FROM golang:1-alpine as builder
8+
WORKDIR /go/src/mysqlrouter_exporter
9+
COPY . .
10+
RUN apk --no-cache add git openssh build-base
11+
RUN go build -ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" -o app .
12+
13+
FROM alpine as production
14+
LABEL maintainer="rluisr" \
15+
org.opencontainers.image.url="https://github.com/rluisr/mysqlrouter_exporter" \
16+
org.opencontainers.image.source="https://github.com/rluisr/mysqlrouter_exporter" \
17+
org.opencontainers.image.vendor="rluisr" \
18+
org.opencontainers.image.title="mysqlrouter_exporter" \
19+
org.opencontainers.image.description="Prometheus exporter for MySQL Router." \
20+
org.opencontainers.image.licenses="AGPL"
21+
RUN <<EOF
22+
apk add --no-cache ca-certificates libc6-compat \
23+
rm -rf /var/cache/apk/*
24+
EOF
25+
COPY --from=builder /go/src/mysqlrouter_exporter/app /app
26+
ENTRYPOINT ["/app"]
27+

0 commit comments

Comments
 (0)