File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 43
43
registry : ghcr.io
44
44
username : ${{ github.actor }}
45
45
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')"
46
49
- name : Build and push
47
50
id : docker_build
48
51
uses : docker/build-push-action@v3
52
55
platforms : linux/amd64,linux/arm64
53
56
build-args : |
54
57
VERSION=${{github.ref_name}}
58
+ COMMIT=${{github.sha}}
59
+ DATE=${{ steps.date.outputs.date }}
55
60
tags : ${{ steps.meta.outputs.tags }}
56
61
labels : ${{ steps.meta.outputs.labels }}
57
62
push : ${{ github.event_name != 'pull_request' }}
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments