Skip to content

Instantly share code, notes, and snippets.

@carrfane
Last active March 21, 2024 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save carrfane/d4f7b75a5e534cd9c2ed4b50e032eff2 to your computer and use it in GitHub Desktop.
Save carrfane/d4f7b75a5e534cd9c2ed4b50e032eff2 to your computer and use it in GitHub Desktop.
Serverless setting with custom dockerfile
FROM public.ecr.aws/lambda/ruby:3.2
RUN yum install -y amazon-linux-extras
RUN amazon-linux-extras enable postgresql14
RUN yum group install "Development Tools" -y
RUN yum install -y postgresql postgresql-devel
RUN gem update bundler
CMD "/bin/bash"
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
ruby "3.2.2"
gem "activerecord", "~> 7.1"
gem "activerecord-import", "~> 1.5"
gem "pg"
service: use-docker-file
plugins:
- serverless-ruby-layer
custom:
rubyLayer:
use_docker: true
docker_file: Dockerfile
native_libs:
- /usr/lib64/libpq.so.5
- /usr/lib64/libldap_r-2.4.so.2
- /usr/lib64/liblber-2.4.so.2
- /usr/lib64/libsasl2.so.3
- /usr/lib64/libssl3.so
- /usr/lib64/libsmime3.so
- /usr/lib64/libnss3.so
provider:
name: aws
runtime: ruby3.2
environment:
LD_PRELOAD: '/opt/lib/libnssutil3.so'
functions:
hello:
handler: handler.hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment