Skip to content

Commit 04823da

Browse files
author
Dudi Dolev
committed
WIP
1 parent 2be9563 commit 04823da

File tree

2 files changed

+87
-9
lines changed

2 files changed

+87
-9
lines changed

Dockerfile

+82-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,84 @@
1-
FROM alpine AS builder
2-
RUN apk add --no-cache ca-certificates
1+
# #FROM alpine AS builder
2+
# FROM docker.io/bitnami/minideb:bookworm
3+
# #RUN apk add --no-cache ca-certificates
4+
# RUN install_packages ca-certificates curl procps
5+
6+
# RUN apt-get autoremove --purge -y curl && \
7+
# apt-get update && apt-get upgrade -y && \
8+
# apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives
9+
10+
# #FROM scratch AS final
11+
# USER 1001:1001
12+
# #COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
13+
# COPY ./mongodb_exporter /bin/mongodb_exporter
14+
# #RUN chmod g+rwX /bin/mongodb_exporter
15+
# RUN chmod 777 /bin/mongodb_exporter
16+
17+
# EXPOSE 9216
18+
# ENTRYPOINT ["/mongodb_exporter"]
19+
20+
21+
22+
# Copyright Broadcom, Inc. All Rights Reserved.
23+
# SPDX-License-Identifier: APACHE-2.0
24+
25+
FROM docker.io/bitnami/minideb:bookworm
26+
27+
ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith"
28+
ARG TARGETARCH
29+
30+
LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \
31+
org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \
32+
org.opencontainers.image.created="2025-01-17T03:23:22Z" \
33+
org.opencontainers.image.description="Application packaged by Broadcom, Inc." \
34+
org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mongodb-exporter/README.md" \
35+
org.opencontainers.image.licenses="Apache-2.0" \
36+
org.opencontainers.image.ref.name="0.43.1-debian-12-r2" \
37+
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mongodb-exporter" \
38+
org.opencontainers.image.title="mongodb-exporter" \
39+
org.opencontainers.image.vendor="Broadcom, Inc." \
40+
org.opencontainers.image.version="0.43.1"
41+
42+
ENV HOME="/" \
43+
OS_ARCH="${TARGETARCH:-amd64}" \
44+
OS_FLAVOUR="debian-12" \
45+
OS_NAME="linux"
46+
47+
# COPY prebuildfs /
48+
# SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"]
49+
# Install required system packages and dependencies
50+
RUN install_packages ca-certificates curl procps
51+
# RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \
52+
# COMPONENTS=( \
53+
# "mongodb-exporter-0.43.1-1-linux-${OS_ARCH}-debian-12" \
54+
# ) ; \
55+
# for COMPONENT in "${COMPONENTS[@]}"; do \
56+
# if [ ! -f "${COMPONENT}.tar.gz" ]; then \
57+
# curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz" -O ; \
58+
# curl -SsLf "https://${DOWNLOADS_URL}/${COMPONENT}.tar.gz.sha256" -O ; \
59+
# fi ; \
60+
# sha256sum -c "${COMPONENT}.tar.gz.sha256" ; \
61+
# tar -zxf "${COMPONENT}.tar.gz" -C /opt/bitnami --strip-components=2 --no-same-owner --wildcards '*/files' ; \
62+
# rm -rf "${COMPONENT}".tar.gz{,.sha256} ; \
63+
# done
64+
65+
RUN mkdir -p /opt/bitnami/mongodb-exporter/bin
66+
67+
COPY ./mongodb_exporter /opt/bitnami/mongodb-exporter/bin/mongodb_exporter
68+
69+
RUN apt-get autoremove --purge -y curl && \
70+
apt-get update && apt-get upgrade -y && \
71+
apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives
72+
RUN chmod g+rwX /opt/bitnami
73+
RUN find / -perm /6000 -type f -exec chmod a-s {} \; || true
74+
RUN ln -sf /opt/bitnami/mongodb-exporter/bin/mongodb_exporter /bin/mongodb_exporter
75+
76+
ENV APP_VERSION="0.43.1" \
77+
BITNAMI_APP_NAME="mongodb-exporter" \
78+
PATH="/opt/bitnami/mongodb-exporter/bin:$PATH"
379

4-
FROM scratch AS final
5-
USER 65535:65535
6-
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
7-
COPY ./mongodb_exporter /
880
EXPOSE 9216
9-
ENTRYPOINT ["/mongodb_exporter"]
81+
82+
WORKDIR /opt/bitnami/mongodb-exporter
83+
USER 1001
84+
ENTRYPOINT [ "mongodb_exporter" ]

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ GO_TEST_PATH ?= ./...
55
GO_TEST_EXTRA ?=
66
GO_TEST_COVER_PROFILE ?= cover.out
77
GO_TEST_CODECOV ?=
8+
GOARCH = amd64
9+
CGO_ENABLED = 0
10+
GOOS = linux
811

912
BUILD ?= $(shell date +%FT%T%z)
1013
GOVERSION ?= $(shell go version | cut -d " " -f3)
@@ -68,10 +71,10 @@ env:
6871
@echo $(TEST_ENV) | tr ' ' '\n' >.env
6972

7073
init: ## Install linters.
71-
cd tools && go generate -x -tags=tools
74+
cd tools && GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go generate -x -tags=tools
7275

7376
build: ## Compile using plain go build
74-
go build -ldflags="$(GO_BUILD_LDFLAGS)" -o $(PMM_RELEASE_PATH)/mongodb_exporter
77+
GOARCH=amd64 CGO_ENABLED=0 GOOS=linux go build -ldflags="$(GO_BUILD_LDFLAGS)" -o $(PMM_RELEASE_PATH)/mongodb_exporter
7578

7679
release: ## Build the binaries using goreleaser
7780
docker run --rm --privileged \

0 commit comments

Comments
 (0)