forked from iamseth/oracledb_exporter
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
44 lines (29 loc) · 1.3 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM golang:1.11 AS build
RUN apt-get -qq update && apt-get install --no-install-recommends -qq libaio1 rpm
COPY *.rpm /
RUN rpm -Uvh --nodeps /oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm /oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm && rm /*.rpm
RUN echo $LD_LIBRARY_PATH >> /etc/ld.so.conf.d/oracle.conf && ldconfig
WORKDIR /go/src/oracledb_exporter
COPY . .
RUN go get -d -v
ARG VERSION
ENV VERSION ${VERSION:-0.1.0}
ENV PKG_CONFIG_PATH /go/src/oracledb_exporter
ENV GOOS linux
ENV LD_LIBRARY_PATH /usr/lib/oracle/12.2/client64/lib
RUN go build -v -ldflags "-X main.Version=${VERSION} -s -w"
FROM ubuntu:18.04
MAINTAINER Yannig Perré <yannig.perre@gmail.com>
ENV VERSION ${VERSION:-0.1.0}
COPY oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm /
RUN apt-get -qq update && \
apt-get install --no-install-recommends -qq libaio1 rpm -y && rpm -Uvh --nodeps /oracle*rpm && \
rm -f /oracle*rpm
ENV LD_LIBRARY_PATH /usr/lib/oracle/12.2/client64/lib
RUN echo $LD_LIBRARY_PATH >> /etc/ld.so.conf.d/oracle.conf && ldconfig
COPY --from=build /go/src/oracledb_exporter/oracledb_exporter /oracledb_exporter
ADD ./default-metrics.toml /default-metrics.toml
ENV DATA_SOURCE_NAME system/oracle@oracle/xe
RUN chmod 755 /oracledb_exporter
EXPOSE 9161
ENTRYPOINT ["/oracledb_exporter"]