Skip to content

Commit 483b937

Browse files
author
Jef Spaleta
committed
update asset Dockerfile build instructions to deal with shared libs needed by pg native extensions
1 parent 8920889 commit 483b937

File tree

7 files changed

+50
-2
lines changed

7 files changed

+50
-2
lines changed

asset_build_scripts/Dockerfile.alpine

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@ FROM sensu/sensu-ruby-runtime-2.4.4-alpine:latest as builder
22
ARG ASSET_GEM
33
ARG GIT_REF
44
ARG GIT_REPO
5+
ARG RUBY_VERSION=2.4.4
6+
57
WORKDIR /assets/build/
6-
RUN apk info -vv | grep 'ssl'
78
RUN apk del openssl-dev
89
RUN apk add git
910
RUN apk add libressl-dev postgresql-client postgresql-dev
1011
RUN \
1112
gem install --no-ri --no-doc bundler && \
1213
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
1314
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
15+
16+
RUN LIBS=$(find ./ -type f -exec ldd {} 2>/dev/null \;| grep "=>" | grep -v "vdso.so.1" | awk '{print $3}'| sort -u ) && \
17+
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
18+
19+
1420
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
1521

1622
FROM scratch

asset_build_scripts/Dockerfile.alpine3.8

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ FROM sensu/sensu-ruby-runtime-2.4.4-alpine3.8:latest as builder
22
ARG ASSET_GEM
33
ARG GIT_REF
44
ARG GIT_REPO
5+
ARG RUBY_VERSION=2.4.4
6+
57
WORKDIR /assets/build/
8+
RUN apk del openssl-dev
69
RUN apk add git
7-
RUN apk add postgresql-client postgresql-dev
10+
RUN apk add libressl-dev postgresql-client postgresql-dev
811
RUN \
912
gem install --no-ri --no-doc bundler && \
1013
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
1114
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
15+
16+
RUN LIBS=$(find ./ -type f -exec ldd {} 2>/dev/null \;| grep "=>" | grep -v "vdso.so.1" | awk '{print $3}'| sort -u ) && \
17+
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
18+
1219
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
1320

1421
FROM scratch

asset_build_scripts/Dockerfile.centos

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ FROM sensu/sensu-ruby-runtime-2.4.4-centos:latest as builder
22
ARG ASSET_GEM
33
ARG GIT_REF
44
ARG GIT_REPO
5+
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)'
6+
ARG RUBY_VERSION=2.4.4
7+
58
WORKDIR /assets/build/
69
RUN yum install -y git
710
RUN yum install -y http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-3.noarch.rpm
@@ -11,6 +14,10 @@ RUN \
1114
gem install --no-ri --no-doc bundler && \
1215
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
1316
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
17+
18+
RUN LIBS=$(find ./ -type f -executable -exec ldd {} 2>/dev/null \;| grep "=>" | egrep -v ${GREP_EXCLUDE} | awk '{print $3}'| sort -u ) && \
19+
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
20+
1421
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
1522

1623
FROM scratch

asset_build_scripts/Dockerfile.centos6

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ FROM sensu/sensu-ruby-runtime-2.4.4-centos6:latest as builder
22
ARG ASSET_GEM
33
ARG GIT_REF
44
ARG GIT_REPO
5+
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)'
6+
ARG RUBY_VERSION=2.4.4
7+
58
WORKDIR /assets/build/
69
RUN yum install -y git
710
RUN yum install -y http://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgdg-redhat95-9.5-3.noarch.rpm
@@ -11,6 +14,10 @@ RUN \
1114
gem install --no-ri --no-doc bundler && \
1215
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
1316
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
17+
18+
RUN LIBS=$(find ./ -type f -executable -exec ldd {} 2>/dev/null \;| grep "=>" | egrep -v ${GREP_EXCLUDE} | awk '{print $3}'| sort -u ) && \
19+
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
20+
1421
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
1522

1623
FROM scratch

asset_build_scripts/Dockerfile.centos7

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ FROM sensu/sensu-ruby-runtime-2.4.4-centos7:latest as builder
22
ARG ASSET_GEM
33
ARG GIT_REF
44
ARG GIT_REPO
5+
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)'
6+
ARG RUBY_VERSION=2.4.4
7+
58
WORKDIR /assets/build/
69
RUN yum install -y git
710
RUN yum install -y http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-redhat95-9.5-3.noarch.rpm
@@ -11,6 +14,10 @@ RUN \
1114
gem install --no-ri --no-doc bundler && \
1215
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
1316
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
17+
18+
RUN LIBS=$(find ./ -type f -executable -exec ldd {} 2>/dev/null \;| grep "=>" | egrep -v ${GREP_EXCLUDE} | awk '{print $3}'| sort -u ) && \
19+
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
20+
1421
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
1522

1623
FROM scratch

asset_build_scripts/Dockerfile.debian

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ FROM sensu/sensu-ruby-runtime-2.4.4-debian:latest as builder
22
ARG ASSET_GEM
33
ARG GIT_REF
44
ARG GIT_REPO
5+
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)'
6+
ARG RUBY_VERSION=2.4.4
7+
58
WORKDIR /assets/build/
69
RUN apt-get update && apt-get install -y git
710
RUN apt-get install -y libpq-dev
811
RUN \
912
gem install --no-ri --no-doc bundler && \
1013
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
1114
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
15+
16+
RUN LIBS=$(find ./ -type f -executable -exec ldd {} 2>/dev/null \;| grep "=>" | egrep -v ${GREP_EXCLUDE} | awk '{print $3}'| sort -u ) && \
17+
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
18+
1219
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
1320

1421
FROM scratch

asset_build_scripts/Dockerfile.debian9

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@ FROM sensu/sensu-ruby-runtime-2.4.4-debian9:latest as builder
22
ARG ASSET_GEM
33
ARG GIT_REF
44
ARG GIT_REPO
5+
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)'
6+
ARG RUBY_VERSION=2.4.4
7+
58
WORKDIR /assets/build/
69
RUN apt-get update && apt-get install -y git
710
RUN apt-get install -y libpq-dev
811
RUN \
912
gem install --no-ri --no-doc bundler && \
1013
printf "source 'https://rubygems.org'\n\ngem \"%s\", :git => \"%s\" , :ref => \"%s\"\n" ${ASSET_GEM} ${GIT_REPO} ${GIT_REF}| tee Gemfile
1114
RUN bundle install --path=lib/ --binstubs=bin/ --standalone
15+
16+
RUN LIBS=$(find ./ -type f -executable -exec ldd {} 2>/dev/null \;| grep "=>" | egrep -v ${GREP_EXCLUDE} | awk '{print $3}'| sort -u ) && \
17+
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
18+
1219
RUN tar -czf /assets/${ASSET_GEM}.tar.gz -C /assets/build/ .
1320

1421
FROM scratch

0 commit comments

Comments
 (0)