Skip to content

Commit

Permalink
Merge pull request #89 from orange-cloudfoundry/devel
Browse files Browse the repository at this point in the history
upgrade go and dependencies
  • Loading branch information
romain-dartigues authored May 14, 2024
2 parents aa5c437 + 7772729 commit 80e4add
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/after-merge-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- name: Fetch dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.6.0
uses: dependabot/fetch-metadata@v2.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: set up go
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: cache go modules
uses: actions/cache@v4
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build-and-release

on:
push:
branches:
- '!*'
tags:
- 'v[0-9].*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Compute docker tags
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v5
with:
images: orangeopensource/credhub-exporter

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish to DockerHub
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.docker_meta.outputs.tags }}

- name: Create github release
id: create-github-release
if: success() && startsWith(github.ref, 'refs/tags/')
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
Resource image available:
```
${{ steps.docker_meta.outputs.tags }}
```
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: set up go
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"

- name: cache go modules
uses: actions/cache@v4
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Stage 1
FROM golang:1.22 as builder
WORKDIR /go/src/app
COPY . .
RUN go mod tidy
RUN go mod vendor
RUN CGO_ENABLED=0 go build -o /go/bin/app/credhub_exporter -a -tags netgo -ldflags '-w -extldflags "-static"'

# Stage 2
FROM alpine:3.19
RUN apk add --no-cache ca-certificates
COPY --from=builder /go/bin/app/credhub_exporter /bin/credhub_exporter
EXPOSE 9358
ENTRYPOINT ["/bin/credhub_exporter"]

0 comments on commit 80e4add

Please sign in to comment.