-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from orange-cloudfoundry/dockerfile
Added dockerfile (test)
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |