-
Notifications
You must be signed in to change notification settings - Fork 5
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 #5 from nohn/build_docker_image_via_github_actions
Build docker image via GitHub actions
- Loading branch information
Showing
4 changed files
with
87 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,23 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
|
||
jobs: | ||
docker-build-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Pull Code' | ||
uses: actions/checkout@main | ||
- name: 'Login to GitHub Container Registry' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
- name: 'Build Inventory Image' | ||
run: | | ||
docker build . --tag ghcr.io/$GITHUB_REPOSITORY_OWNER/downdetector-exporter:latest | ||
docker push ghcr.io/$GITHUB_REPOSITORY_OWNER/downdetector-exporter:latest |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
downdetector-credentials.yaml | ||
downdetector-exporter | ||
*~ |
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,18 @@ | ||
FROM golang:1.19 AS build-stage | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY *.go ./ | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /downdetector-exporter | ||
|
||
FROM gcr.io/distroless/base-debian12 AS build-release-stage | ||
|
||
WORKDIR / | ||
COPY --from=build-stage /downdetector-exporter /downdetector-exporter | ||
EXPOSE 9313 | ||
USER nonroot:nonroot | ||
ENTRYPOINT ["/downdetector-exporter"] | ||
|
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