Skip to content

Commit

Permalink
Use offical ruby lambda image for services
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Sep 13, 2024
1 parent be39e6e commit 524c206
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
{
"identifier": "switch-services-staging",
"environment": "staging",
"branch": "develop",
"branch": "use_official_aws_lambda_images",
"image_tag": "staging"
},
{
Expand Down
19 changes: 7 additions & 12 deletions components/services/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
ARG FUNCTION_DIR="/function"
ARG RUBY_VERSION=3.3
FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine AS build-image
FROM public.ecr.aws/lambda/ruby:$RUBY_VERSION AS build-image

RUN apk update && \
apk upgrade && \
apk add --update --no-cache build-base postgresql-dev
RUN dnf update && \
dnf -y install postgresql-devel openssl-devel gcc make

RUN gem install bundler

Expand All @@ -28,23 +27,19 @@ COPY app/ ${FUNCTION_DIR}/app/
COPY config/ ${FUNCTION_DIR}/config/
COPY lib/ ${FUNCTION_DIR}/lib/

#############################
# #############################

FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine
FROM public.ecr.aws/lambda/ruby:$RUBY_VERSION

ARG FUNCTION_DIR
WORKDIR ${FUNCTION_DIR}

ENV BUNDLE_APP_CONFIG="${FUNCTION_DIR}/.bundle"
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR}

RUN apk update && \
apk upgrade && \
apk add --update --no-cache postgresql-dev && \
gem install bundler && \
gem install aws_lambda_ric
RUN dnf update && \
dnf -y install postgresql-devel

ENV RUBY_YJIT_ENABLE=true

ENTRYPOINT [ "/usr/local/bundle/bin/aws_lambda_ric" ]
CMD [ "app.App::Handler.process" ]
1 change: 1 addition & 0 deletions components/services/config/app_settings.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "yaml"
require "erb"
require "pathname"

class AppSettings
DEFAULT_SETTINGS_PATH = Pathname(File.expand_path("app_settings.yml", __dir__))
Expand Down
2 changes: 2 additions & 0 deletions components/services/config/initializers/aws_stubs.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "aws-sdk-core"

if %w[development test].include?(AppSettings.env)
Aws.config[:ssm] = {
stub_responses: {
Expand Down
1 change: 1 addition & 0 deletions components/services/lib/encrypted_credentials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require "tempfile"
require "openssl"
require "base64"
require "pathname"

module EncryptedCredentials
class EncryptedFile
Expand Down

0 comments on commit 524c206

Please sign in to comment.