From 93c6a2634423972c301c28d236e4f401dbb74958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Naveiras?= Date: Fri, 18 Feb 2022 11:16:39 +0000 Subject: [PATCH] Updated golang 1.17.7 This PR updates golang and orther dependecies. It also renames the github action workflow and adds a linter for the dockerfile --- .github/workflows/{go.yml => build.yaml} | 25 +++++++++++++++++------- .promu.yml | 2 +- Dockerfile | 15 ++++++++------ 3 files changed, 28 insertions(+), 14 deletions(-) rename .github/workflows/{go.yml => build.yaml} (58%) diff --git a/.github/workflows/go.yml b/.github/workflows/build.yaml similarity index 58% rename from .github/workflows/go.yml rename to .github/workflows/build.yaml index 2f045615..9767f04f 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/build.yaml @@ -1,17 +1,27 @@ --- -name: Go +name: Build + on: [push] + jobs: + linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.4.0 + - name: Lint Dockerfile + uses: hadolint/hadolint-action@master + with: + dockerfile: "Dockerfile" mod-tidy: name: mod-tidy runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v2.4.0 - name: set up go - uses: actions/setup-go@v2 + uses: actions/setup-go@v2.2.0 with: - go-version: 1.15.6 + go-version: 1.17.7 id: go - name: go mod tidy run: go mod tidy @@ -26,12 +36,13 @@ jobs: needs: [mod-tidy] steps: - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v2.4.0 - name: set up go - uses: actions/setup-go@v2 + uses: actions/setup-go@v2.2.0 with: - go-version: 1.15.6 + go-version: 1.17.7 id: go + - run: go version - name: Promu run: make promu - name: Build diff --git a/.promu.yml b/.promu.yml index 63325dc8..f7fab007 100644 --- a/.promu.yml +++ b/.promu.yml @@ -1,7 +1,7 @@ --- verbose: false go: - version: 1.16.3 + version: 1.17.7 repository: path: github.com/rnaveiras/postgres_exporter build: diff --git a/Dockerfile b/Dockerfile index 5820faa2..b0867dad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,13 @@ -FROM golang:1.16-alpine3.12 as builder +# syntax=docker/dockerfile:1 +FROM golang:1.17.7-alpine3.15 as builder -ENV PROMU_SHA256=17d991fea8e992636272d9b4e24b72c104d305ed1460d40891894fae6b6c64a2 \ - PROMU_VERSION=0.12.0 +ENV PROMU_SHA256=41bdeadd6bb761058adc82e1c0fc9951ca3eac9d0556d29bdf01993f7afd1f57 \ + PROMU_VERSION=0.13.0 -RUN set -x \ - && apk --no-cache add curl ca-certificates git \ +SHELL ["/bin/ash", "-euox", "pipefail", "-c"] + +# hadolint ignore=DL3018 +RUN apk --no-cache add curl ca-certificates git \ && curl -o /tmp/promu.tar.gz -fsL https://github.com/prometheus/promu/releases/download/v${PROMU_VERSION}/promu-${PROMU_VERSION}.linux-amd64.tar.gz \ && echo "${PROMU_SHA256} /tmp/promu.tar.gz" | sha256sum -c \ && tar xvfz /tmp/promu.tar.gz -C /tmp \ @@ -19,7 +22,7 @@ RUN set -x \ && promu build --verbose --prefix=./output \ && find ./output -FROM alpine:3.12 +FROM alpine:3.15 LABEL maintainer="Raul Naveiras " COPY --from=builder /go/src/app/output/postgres_exporter /bin/postgres_exporter