-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.debian10
18 lines (15 loc) · 1.27 KB
/
Dockerfile.debian10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
FROM sensu-ruby32-runtime-3.2.2-debian10:0.1.2
ARG ASSET_GEM=sensu-plugins-postgres
ARG GIT_REF=398db3263e58a8c99fe1f7a7355dc3aa94a538fd
ARG GIT_REPO=https://github.com/opsone/sensu-plugins-postgres.git
ARG GREP_EXCLUDE='(ld.so|ld-linux-x86-64.so|libBrokenLocale.so|libSegFault.so|libanl.so|libc.so|libdl.so|libm.so|libmvec.so|libnss_compat.so|libnss_dns.so|libnss_files.so|libpthread.so|libresolv.so|librt.so|libthread_db.so|libutil.so|vdso.so)'
WORKDIR /assets/build/
RUN apt-get update && apt-get install -y git
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN apt-get update && apt-get install -y libpq-dev
RUN printf "source 'https://rubygems.org'\n\ngem '%s', git: '%s' , ref: '%s'\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF} | tee Gemfile
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
RUN LIBS=$(find ./ -type f -executable -exec ldd {} 2>/dev/null \;| grep "=>" | egrep -v ${GREP_EXCLUDE} | awk '{print $3}'| sort -u ) && \
for f in $LIBS; do if [ -e $f ] && [ ! -e /opt/rubies/ruby-${RUBY_VERSION}/lib/$f ] ; then echo "Copying Library: $f" && cp $f ./lib/; fi; done
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .