forked from iamseth/oracledb_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (38 loc) · 1.66 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
45
46
47
48
49
50
51
52
53
54
FROM golang:1.14 AS build
ARG ORACLE_VERSION
ENV ORACLE_VERSION=${ORACLE_VERSION}
ENV LD_LIBRARY_PATH "/usr/lib/oracle/${ORACLE_VERSION}/client64/lib"
RUN apt-get -qq update && apt-get install --no-install-recommends -qq libaio1 rpm
COPY oci8.pc.template /usr/share/pkgconfig/oci8.pc
RUN sed -i "s/@ORACLE_VERSION@/$ORACLE_VERSION/g" /usr/share/pkgconfig/oci8.pc
COPY oracle*${ORACLE_VERSION}*.rpm /
RUN rpm -Uh --nodeps /oracle-instantclient*.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
RUN go build -v -ldflags "-X main.Version=${VERSION} -s -w"
FROM ubuntu:18.04
LABEL authors="Seth Miller,Yannig Perré"
LABEL maintainer="Yannig Perré <[email protected]>"
ENV VERSION ${VERSION:-0.1.0}
COPY oracle-instantclient*${ORACLE_VERSION}*basic*.rpm /
RUN apt-get -qq update && \
apt-get -qq install --no-install-recommends -qq libaio1 rpm -y && rpm -Uvh --nodeps /oracle*${ORACLE_VERSION}*rpm && \
rm -f /oracle*rpm
ARG ORACLE_VERSION
ENV ORACLE_VERSION=${ORACLE_VERSION}
ENV LD_LIBRARY_PATH "/usr/lib/oracle/${ORACLE_VERSION}/client64/lib"
RUN echo $LD_LIBRARY_PATH >> /etc/ld.so.conf.d/oracle.conf && ldconfig
ARG LEGACY_TABLESPACE
ENV LEGACY_TABLESPACE=${LEGACY_TABLESPACE}
COPY --from=build /go/src/oracledb_exporter/oracledb_exporter /oracledb_exporter
ADD ./default-metrics${LEGACY_TABLESPACE}.toml /default-metrics.toml
ENV DATA_SOURCE_NAME system/oracle@oracle/xe
RUN chmod 755 /oracledb_exporter
EXPOSE 9161
ENTRYPOINT ["/oracledb_exporter"]