ceph_exporter/Dockerfile

60 lines
2.1 KiB
Docker
Raw Permalink Normal View History

2023-04-05 16:57:18 +00:00
# Copyright 2023 DigitalOcean
2022-03-23 21:02:21 +00:00
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:20.04 as builder
2016-01-06 19:07:02 +00:00
ARG TEST
ENV GOROOT /goroot
2016-01-06 19:07:02 +00:00
ENV GOPATH /go
ENV PATH $GOROOT/bin:$PATH
2016-07-26 03:19:26 +00:00
ENV APPLOC $GOPATH/src/github.com/digitalocean/ceph_exporter
2016-01-06 19:07:02 +00:00
RUN apt-get update && \
2018-05-10 03:04:07 +00:00
apt-get install -y apt-transport-https build-essential git curl wget
2018-05-10 03:04:07 +00:00
RUN wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add -
RUN echo "deb https://download.ceph.com/debian-nautilus focal main" >> /etc/apt/sources.list
RUN apt-get update && \
apt-get install -y --force-yes librados-dev librbd-dev
2016-01-06 19:07:02 +00:00
RUN \
mkdir -p /goroot && \
2023-04-05 16:57:18 +00:00
curl https://storage.googleapis.com/golang/go1.20.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1
ADD . $APPLOC
2016-01-06 19:07:02 +00:00
WORKDIR $APPLOC
RUN go get -d
# The `-tags nautilus` instructs go-ceph to enable additional support nautilus release.
# See https://github.com/ceph/go-ceph#installation
RUN if [ -n "${TEST}" ]; then go test -tags nautilus -v -race -count=1 ./...; fi
RUN go build -tags nautilus -o /bin/ceph_exporter
FROM ubuntu:20.04
RUN apt-get update && \
2019-10-01 17:12:02 +00:00
apt-get install -y apt-transport-https curl wget gnupg
2018-05-10 03:04:07 +00:00
RUN wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add -
RUN echo "deb https://download.ceph.com/debian-nautilus focal main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y --force-yes librados2 librbd1 ceph-common && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /bin/ceph_exporter /bin/ceph_exporter
RUN chmod +x /bin/ceph_exporter
EXPOSE 9128
ENTRYPOINT ["/bin/ceph_exporter"]