Skip to content

Commit 9faa3f0

Browse files
HenryXie1Yannig
authored andcommitted
add oraclelinux support
1 parent 9125f86 commit 9faa3f0

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ sgerrand.rsa.pub:
6565
glibc-2.29-r0.apk:
6666
wget -q -O glibc-2.29-r0.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk
6767

68+
oraclelinux-image: $(ORA_RPM)
69+
docker build -f oraclelinux/Dockerfile $(BUILD_ARGS) -t "iamseth/oracledb_exporter:$(VERSION)-oraclelinux" .
70+
docker tag "iamseth/oracledb_exporter:$(VERSION)-oraclelinux" "iamseth/oracledb_exporter:oraclelinux"
71+
6872
ubuntu-image: $(ORA_RPM)
6973
docker build $(BUILD_ARGS) -t "iamseth/oracledb_exporter:$(VERSION)" .
7074
docker tag "iamseth/oracledb_exporter:$(VERSION)" "iamseth/oracledb_exporter:latest"

oraclelinux/Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM golang:1.14 AS build
2+
3+
ARG ORACLE_VERSION
4+
ENV ORACLE_VERSION=${ORACLE_VERSION}
5+
ENV LD_LIBRARY_PATH "/usr/lib/oracle/${ORACLE_VERSION}/client64/lib"
6+
7+
RUN apt-get -qq update && apt-get install --no-install-recommends -qq libaio1 rpm
8+
COPY oci8.pc.template /usr/share/pkgconfig/oci8.pc
9+
RUN sed -i "s/@ORACLE_VERSION@/$ORACLE_VERSION/g" /usr/share/pkgconfig/oci8.pc
10+
COPY oracle*${ORACLE_VERSION}*.rpm /
11+
RUN rpm -Uh --nodeps /oracle-instantclient*.x86_64.rpm && rm /*.rpm
12+
RUN echo $LD_LIBRARY_PATH >> /etc/ld.so.conf.d/oracle.conf && ldconfig
13+
14+
WORKDIR /go/src/oracledb_exporter
15+
COPY . .
16+
RUN go get -d -v
17+
18+
ARG VERSION
19+
ENV VERSION ${VERSION:-0.1.0}
20+
21+
ENV PKG_CONFIG_PATH /go/src/oracledb_exporter
22+
ENV GOOS linux
23+
24+
RUN go build -v -ldflags "-X main.Version=${VERSION} -s -w"
25+
26+
27+
FROM oraclelinux:7-slim
28+
29+
ARG ORACLE_VERSION
30+
ENV ORACLE_VERSION=${ORACLE_VERSION}
31+
RUN yum -y install oracle-release-el7 && \
32+
yum -y --setopt=tsflags=nodocs update && \
33+
# yum list oracle-instantclient* && \
34+
yum -y --setopt=tsflags=nodocs install oracle-instantclient${ORACLE_VERSION}-basic.x86_64 && \
35+
yum clean all
36+
37+
38+
COPY --from=build /go/src/oracledb_exporter/oracledb_exporter /oracledb_exporter
39+
ADD ./default-metrics.toml /default-metrics.toml
40+
41+
RUN chmod 755 /oracledb_exporter && \
42+
chmod 644 /default-metrics.toml && \
43+
groupadd www-data && useradd -g www-data www-data
44+
USER www-data
45+
ENV DATA_SOURCE_NAME system/oracle@oracle/xe
46+
ENV LD_LIBRARY_PATH "/usr/lib/oracle/${ORACLE_VERSION}/client64/lib"
47+
48+
EXPOSE 9161
49+
50+
ENTRYPOINT ["/oracledb_exporter"]

0 commit comments

Comments
 (0)