Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rluisr committed Feb 9, 2023
1 parent b2045c2 commit ccf6f12
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get current date and time
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M')"
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
Expand All @@ -52,6 +55,8 @@ jobs:
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{github.ref_name}}
COMMIT=${{github.sha}}
DATE=${{ steps.date.outputs.date }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# syntax = docker/dockerfile:1.3-labs

ARG VERSION=0.0.0
ARG COMMIT=''
ARG DATE=''

FROM golang:1-alpine as builder
WORKDIR /go/src/mysqlrouter_exporter
COPY . .
RUN apk --no-cache add git openssh build-base
RUN go build -ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" -o app .

FROM alpine as production
LABEL maintainer="rluisr" \
org.opencontainers.image.url="https://github.com/rluisr/mysqlrouter_exporter" \
org.opencontainers.image.source="https://github.com/rluisr/mysqlrouter_exporter" \
org.opencontainers.image.vendor="rluisr" \
org.opencontainers.image.title="mysqlrouter_exporter" \
org.opencontainers.image.description="Prometheus exporter for MySQL Router." \
org.opencontainers.image.licenses="AGPL"
RUN <<EOF
apk add --no-cache ca-certificates libc6-compat \
rm -rf /var/cache/apk/*
EOF
COPY --from=builder /go/src/mysqlrouter_exporter/app /app
ENTRYPOINT ["/app"]

0 comments on commit ccf6f12

Please sign in to comment.