Compare commits
4 commits
135c0ec08f
...
8173a01337
Author | SHA1 | Date | |
---|---|---|---|
8173a01337 | |||
|
62f1c8aef3 | ||
|
ee6b5ff3e4 | ||
|
59d8c95c1b |
3 changed files with 22 additions and 22 deletions
4
.github/workflows/integration.yml
vendored
4
.github/workflows/integration.yml
vendored
|
@ -15,7 +15,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.x"
|
go-version: "1.19.x"
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.x"
|
go-version: "1.19.x"
|
||||||
|
|
||||||
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup go
|
- name: Setup go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.19.x"
|
go-version: "1.19.x"
|
||||||
|
|
||||||
|
|
38
Dockerfile
38
Dockerfile
|
@ -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
|
WORKDIR /app
|
||||||
ENV UID=10001
|
|
||||||
|
|
||||||
RUN adduser \
|
COPY go.mod go.sum ./
|
||||||
--disabled-password \
|
RUN go mod download
|
||||||
--gecos "" \
|
|
||||||
--home "/nonexistent" \
|
|
||||||
--shell "/sbin/nologin" \
|
|
||||||
--no-create-home \
|
|
||||||
--uid "${UID}" \
|
|
||||||
"${USER}"
|
|
||||||
|
|
||||||
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
|
# Run the tests in the container
|
||||||
COPY --from=builder /etc/group /etc/group
|
FROM build-stage AS run-test-stage
|
||||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
RUN go test -v ./...
|
||||||
COPY prometheus-mastodon-exporter /prometheus-mastodon-exporter
|
|
||||||
|
|
||||||
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
|
EXPOSE 13120
|
||||||
|
|
||||||
|
USER nonroot:nonroot
|
||||||
|
|
||||||
ENTRYPOINT ["/prometheus-mastodon-exporter"]
|
ENTRYPOINT ["/prometheus-mastodon-exporter"]
|
||||||
|
|
Loading…
Reference in a new issue