Compare commits

..

4 commits

Author SHA1 Message Date
8173a01337 optimize dockerfile 2023-12-17 23:50:28 +00:00
dependabot[bot]
62f1c8aef3
Bump alpine from 3.18.5 to 3.19.0 (#28)
Bumps alpine from 3.18.5 to 3.19.0.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-08 08:58:30 +00:00
dependabot[bot]
ee6b5ff3e4
Bump the github-actions group with 1 update (#27)
Bumps the github-actions group with 1 update: [actions/setup-go](https://github.com/actions/setup-go).

- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-08 08:26:41 +00:00
dependabot[bot]
59d8c95c1b
Bump alpine from 3.18.4 to 3.18.5 (#26)
Bumps alpine from 3.18.4 to 3.18.5.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-01 08:35:55 +00:00
3 changed files with 22 additions and 22 deletions

View file

@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.19.x"
@ -44,7 +44,7 @@ jobs:
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.19.x"

View file

@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: "1.19.x"

View file

@ -1,30 +1,30 @@
FROM alpine:3.18.4 as builder
# syntax=docker/dockerfile:1
WORKDIR /go/src/github.com/systemli/prometheus-mastodon-exporter
# Build the application from source
FROM golang:1.21.4 AS build-stage
ENV USER=appuser
ENV UID=10001
WORKDIR /app
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
COPY go.mod go.sum ./
RUN go mod download
RUN apk add --no-cache --update ca-certificates
COPY *.go ./
FROM scratch
RUN CGO_ENABLED=0 GOOS=linux go build -o /prometheus-mastodon-exporter
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY prometheus-mastodon-exporter /prometheus-mastodon-exporter
# Run the tests in the container
FROM build-stage AS run-test-stage
RUN go test -v ./...
USER appuser:appuser
# Deploy the application binary into a lean image
FROM gcr.io/distroless/base-debian11 AS build-release-stage
WORKDIR /
COPY --from=build-stage /prometheus-mastodon-exporter /prometheus-mastodon-exporter
EXPOSE 13120
USER nonroot:nonroot
ENTRYPOINT ["/prometheus-mastodon-exporter"]