mirror of
https://github.com/digitalocean/ceph_exporter
synced 2025-03-22 02:47:54 +00:00
add TEST flag to Dockerfile to run unit tests during build
This commit is contained in:
parent
2e09636ca1
commit
6978043dba
@ -1,6 +1,8 @@
|
||||
FROM ubuntu:16.04 as builder
|
||||
MAINTAINER Vaibhav Bhembre <vaibhav@digitalocean.com>
|
||||
|
||||
ARG TEST
|
||||
|
||||
ENV GOROOT /goroot
|
||||
ENV GOPATH /go
|
||||
ENV PATH $GOROOT/bin:$PATH
|
||||
@ -21,9 +23,9 @@ RUN \
|
||||
|
||||
ADD . $APPLOC
|
||||
WORKDIR $APPLOC
|
||||
RUN go get -d && \
|
||||
go build -o /bin/ceph_exporter
|
||||
|
||||
RUN go get -d
|
||||
RUN if [ -n "${TEST}" ]; then go test -v ./...; fi
|
||||
RUN go build -o /bin/ceph_exporter
|
||||
|
||||
FROM ubuntu:16.04
|
||||
MAINTAINER Vaibhav Bhembre <vaibhav@digitalocean.com>
|
||||
@ -36,7 +38,6 @@ RUN echo "deb https://download.ceph.com/debian-luminous xenial main" >> /etc/apt
|
||||
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
|
||||
|
||||
|
@ -58,6 +58,10 @@ A sample build command would look like:
|
||||
$ docker build -t digitalocean/ceph_exporter .
|
||||
```
|
||||
|
||||
A `--build-args TEST=true` flag can be added to the build command above
|
||||
to also run `go test` during build:
|
||||
`docker build -t digitalocean/ceph_exporter . --build-arg TEST=true --no-cache`
|
||||
|
||||
You can start running your ceph exporter container now.
|
||||
|
||||
```bash
|
||||
|
Loading…
Reference in New Issue
Block a user