22FROM registry.access.redhat.com/ubi10/ubi-minimal:10.0-1758185635 AS builder
33
44ARG PLAT=x86_64
5- ARG RUBY_VERSION=3.4.3
5+ ARG RUBY_VERSION=3.4.6
66ENV APP_PATH=/app/
77ENV LANGUAGE=en_US:en
88ENV LANG=C.UTF-8
@@ -14,9 +14,6 @@ ENV PATH="/usr/local/bin:$PATH"
1414
1515WORKDIR $APP_PATH
1616
17- # Keep local RPMs available in the build context (not installed on UBI 10)
18- COPY rpms/ /tmp/rpms/
19-
2017# Install build tools and runtime libs in builder
2118RUN set -eux; \
2219 microdnf -y update; \
@@ -34,7 +31,7 @@ RUN set -eux; \
3431 findutils diffutils procps-ng \
3532 ca-certificates \
3633 libpq libpq-devel \
37- gnupg2 ca-certificates \
34+ postgresql \
3835 krb5-libs \
3936 openldap \
4037 cyrus-sasl-lib \
@@ -48,13 +45,9 @@ RUN set -eux; \
4845 pkgconf-pkg-config \
4946 && microdnf clean all
5047
51- # Install PostgreSQL 17 client tools from PGDG for EL10
52- RUN set -eux; \
53- curl -fsSL https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm -o /tmp/pgdg.rpm; \
54- rpm -Uvh /tmp/pgdg.rpm; \
55- microdnf -y module disable postgresql || true; \
56- microdnf -y install postgresql17; \
57- microdnf -y clean all; rm -f /tmp/pgdg.rpm
48+ # Install local RPMs shipped in repo (EL10 builds)
49+ COPY rpms/ /tmp/rpms/
50+ RUN if ls /tmp/rpms/*.rpm >/dev/null 2>&1; then rpm -Uvh --nosignature /tmp/rpms/*.rpm; fi
5851
5952# Build and install Ruby from source (no RVM)
6053RUN set -eux; \
@@ -63,13 +56,25 @@ RUN set -eux; \
6356 cd /tmp/ruby-src; \
6457 ./configure --disable-install-doc --with-openssl-dir=/usr; \
6558 make -j"$(nproc)" && make install; \
66- rm -rf /tmp/ruby-src /tmp/ruby.tar.gz; \
67- gem update --system || true
59+ rm -rf /tmp/ruby-src /tmp/ruby.tar.gz;
6860
6961COPY Gemfile Gemfile.lock .ruby-version $APP_PATH
70- RUN gem install bundler && \
71- bundle config set deployment true && \
72- DOCKER_ENV=true RACK_ENV=production bundle install
62+
63+ RUN mkdir -p ./vendor && \
64+ mkdir -p ./vendor/cache
65+ COPY local_packages/grape-middleware-logger-2.4.0.gem ./vendor/cache/
66+
67+ # Install the EXACT bundler version from Gemfile.lock (“BUNDLED WITH”)
68+ RUN set -eux; \
69+ gem install bundler --no-document
70+
71+ # Deployment settings (allows network, but stays frozen to the lockfile)
72+ # RUN gem install bundler
73+ RUN bundle config set path /app/vendor/cache \
74+ && bundle config set without 'development test'
75+ RUN bundle install --verbose
76+
77+ RUN bundle config set deployment true
7378
7479# Optional Install root certificates.
7580
@@ -103,15 +108,9 @@ RUN mkdir -p /runtime/usr/local /runtime/etc /runtime/usr/bin /runtime/usr/lib64
103108 cp -a /usr/share/crypto-policies/back-ends/opensslcnf.config /runtime/etc/crypto-policies/back-ends/; \
104109 fi && \
105110 cp -a /usr/bin/openssl /runtime/usr/bin/ && \
106- # Copy PostgreSQL client binaries, dereferencing symlinks
107111 for b in /usr/bin/psql /usr/bin/pg_dump /usr/bin/pg_restore; do \
108- cp -L "$b" /runtime/usr/bin/ 2>/dev/null || true; \
112+ cp -a "$b" /runtime/usr/bin/ 2>/dev/null || true; \
109113 done && \
110- if [ -d /usr/pgsql-17/bin ]; then \
111- cp -Lf /usr/pgsql-17/bin/psql /runtime/usr/bin/ 2>/dev/null || true; \
112- cp -Lf /usr/pgsql-17/bin/pg_dump /runtime/usr/bin/ 2>/dev/null || true; \
113- cp -Lf /usr/pgsql-17/bin/pg_restore /runtime/usr/bin/ 2>/dev/null || true; \
114- fi && \
115114 mkdir -p /runtime/usr/lib64/ossl-modules && \
116115 cp -a /usr/lib64/ossl-modules/* /runtime/usr/lib64/ossl-modules/ 2>/dev/null || true
117116
@@ -122,7 +121,7 @@ COPY openssl.cnf /runtime/etc/pki/tls/openssl.cnf
122121# Auto-collect shared library dependencies for Ruby, native gems, and psql
123122RUN set -eux; \
124123 mkdir -p /runtime/usr/lib64; \
125- targets="/usr/local/bin/ruby /usr/bin/psql /usr/bin/pg_dump /usr/bin/pg_restore /usr/pgsql-17/bin/psql /usr/pgsql-17/bin/pg_dump /usr/pgsql-17/bin/pg_restore " ; \
124+ targets="/usr/local/bin/ruby /usr/bin/psql /usr/bin/pg_dump /usr/bin/pg_restore" ; \
126125 if [ -d "$APP_PATH/vendor/bundle" ]; then \
127126 sofiles=$(find "$APP_PATH/vendor/bundle" -type f -name "*.so" || true); \
128127 targets="$targets $sofiles" ; \
@@ -177,19 +176,11 @@ RUN set -eux; \
177176 mkdir -p /runtime/usr/share && cp -a /usr/share/zoneinfo /runtime/usr/share/zoneinfo; \
178177 chmod +x /tmp/docker-entrypoint.sh; cp /tmp/docker-entrypoint.sh /runtime/usr/bin/docker-entrypoint.sh
179178
180- # Ensure PostgreSQL 17 client binaries present in runtime PATH
181- RUN set -eux; \
182- mkdir -p /runtime/usr/bin; \
183- for b in /usr/pgsql-17/bin/psql /usr/pgsql-17/bin/pg_dump /usr/pgsql-17/bin/pg_restore; do \
184- dest="/runtime/usr/bin/$(basename " $b")" ; \
185- if [ -x "$b" ] && [ ! -e "$dest" ]; then cp -a "$b" "$dest" ; fi; \
186- done
187-
188179# Runtime stage (UBI 10 micro)
189180FROM registry.access.redhat.com/ubi10/ubi-micro:10.0-1754556444
190181
191182ENV APP_PATH=/app/
192- ARG RUBY_VERSION=3.4.3
183+ ARG RUBY_VERSION=3.4.6
193184ENV PATH="/usr/local/bin:$PATH"
194185ENV LD_LIBRARY_PATH="/usr/lib64:/lib64:/usr/local/lib"
195186ENV OPENSSL_MODULES="/usr/lib64/ossl-modules"
@@ -213,4 +204,4 @@ USER 1000
213204
214205ENTRYPOINT ["/usr/bin/docker-entrypoint.sh" ]
215206
216- EXPOSE 9292
207+ EXPOSE 9292
0 commit comments