Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Had to fix bin/deploy script due to GLIBC 2.33 not found error. #176

Open
randall-coding opened this issue Mar 8, 2024 · 2 comments
Open

Comments

@randall-coding
Copy link

randall-coding commented Mar 8, 2024

MY SETUP:
OS: Linux Mint 21
GLIBC 2.35
Dockerfile Image: ruby:3.1.4-bullseye (which has GLIBC 2.31)

STEPS TO REPRODUCE
Dockerize existing rails app
make docker/build
Add template.yaml
.bin/deploy (taken from cookiecutter)

ERROR (Cloud Watch logs)
"errorMessage": "/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.18.3/lib/bootsnap/bootsnap.so) - /app/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.18.3/lib/bootsnap/bootsnap.so",

MY FIX
I noticed that the deploy script is bundling all the gems again outside of the image on my host machine which uses a different GLIBC version. I don't know the significance of this or why it is needed (please let me know as I'm new to SAM). However I was able to deploy without error by removing the bundle install lines in bin/deploy like so:

# echo '== Bundle For Deployment =='
# bundle config --global silence_root_warning true
# bundle config --local deployment true
# bundle config --local without 'development test'
# bundle config --local path './vendor/bundle'
# bundle install --quiet --jobs 4

Afterwards I'm able to deploy my lambda without any noticeable issue yet.

What do the devs think of this fix? Am I on to something here or should that bundle install be called on my host machine rather than just inside the Dockerfile?

@randall-coding
Copy link
Author

randall-coding commented Mar 8, 2024

Here is my Dockerfile.

FROM ruby:3.1.4-bullseye

RUN gem install 'aws_lambda_ric'
ENTRYPOINT [ "/usr/local/bundle/bin/aws_lambda_ric" ]

RUN mkdir /app
&& groupadd -g 10001 app
&& useradd -u 10000 -g app app
&& chown -R app:app /app

RUN apt update
&& apt upgrade -y
&& apt install -y --no-install-recommends
tzdata
git
openssh-client
make
gcc
g++
default-libmysqlclient-dev
libxrender1
build-essential
libpq-dev
curl
socat
ca-certificates
gnupg
libc6

RUN echo "DEBUGGING..."
RUN ldd --version

USER app
WORKDIR "/app"

ENV BUNDLE_IGNORE_CONFIG=1
ENV BUNDLE_PATH=./vendor/bundle
ENV BUNDLE_CACHE_PATH=./vendor/cache
ENV RAILS_SERVE_STATIC_FILES=1
COPY --chown=app:app Gemfile ./
RUN bundle install
COPY --chown=app:app . .
CMD ["config/environment.Lamby.cmd"]

@jeremiahlukus
Copy link

jeremiahlukus commented Jun 3, 2024

bundle install is needed to run precompile or run db:migrate. If you do not need to do either of these things then there is no reason to do a bundle install in bin/deploy. Also in the cookie cutter he is running bundle install and coping over the bundle cache which makes the lambda quicker. Im not sure how he got that part to work in arm64 so im doing a bundle install in my Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants