Skip to content

Commit

Permalink
Update services lambda (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie authored May 30, 2024
1 parent 31ba875 commit bbbb2f7
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform 1.5.6
ruby 3.2.2
ruby 3.3.1
golang 1.22.1
2 changes: 1 addition & 1 deletion components/app/.tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.2.2
ruby 3.3.1
9 changes: 6 additions & 3 deletions components/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ruby:3.2-alpine AS build-env
ARG RUBY_VERSION=3.3
FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine AS build-image

ARG APP_ROOT="/app"
ENV BUNDLE_APP_CONFIG="/app/.bundle"
Expand All @@ -23,7 +24,7 @@ RUN mkdir -p tmp/pids
RUN rm -rf vendor/bundle/ruby/*/cache/ && find vendor/ -name "*.o" -delete && find vendor/ -name "*.c"


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

ARG APP_ROOT="/app"
ENV BUNDLE_APP_CONFIG="/app/.bundle"
Expand All @@ -35,6 +36,8 @@ RUN apk update && \
apk add --update --no-cache build-base pcre-dev && \
gem install bundler

COPY --from=build-env $APP_ROOT $APP_ROOT
COPY --from=build-image $APP_ROOT $APP_ROOT

ENV RUBY_YJIT_ENABLE=true

CMD ["bundle", "exec", "ahn", "start", "--no-console"]
31 changes: 16 additions & 15 deletions components/app/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.2)
activesupport (7.1.3.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand All @@ -89,7 +89,7 @@ GEM
adhearsion-loquacious (1.9.3)
ast (2.4.2)
aws-eventstream (1.3.0)
aws-partitions (1.929.0)
aws-partitions (1.936.0)
aws-sdk-core (3.196.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
Expand Down Expand Up @@ -124,7 +124,7 @@ GEM
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.1)
connection_pool (2.4.1)
countdownlatch (1.0.0)
crack (1.0.0)
Expand Down Expand Up @@ -160,7 +160,7 @@ GEM
domain_name (~> 0.5)
http-form_data (2.3.0)
http_parser.rb (0.8.0)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
jmespath (1.6.2)
Expand All @@ -175,8 +175,8 @@ GEM
logging (2.3.1)
little-plugger (~> 1.1)
multi_json (~> 1.14)
method_source (1.0.0)
minitest (5.22.3)
method_source (1.1.0)
minitest (5.23.1)
mock_redis (0.44.0)
multi_json (1.15.0)
mustermann (3.0.0)
Expand All @@ -186,7 +186,7 @@ GEM
uri
niceogiri (1.1.2)
nokogiri (~> 1.5)
nio4r (2.7.1)
nio4r (2.7.3)
nokogiri (1.16.5-arm-linux)
racc (~> 1.4)
nokogiri (1.16.5-arm64-darwin)
Expand All @@ -204,7 +204,7 @@ GEM
method_source (~> 1.0)
public_suffix (5.0.5)
racc (1.8.0)
rack (3.0.10)
rack (3.0.11)
rack-protection (4.0.0)
base64 (>= 0.1.0)
rack (>= 3.0.0, < 4)
Expand All @@ -216,12 +216,12 @@ GEM
rack (>= 3)
webrick (~> 1.8)
rainbow (3.1.1)
rake (13.1.0)
rake (13.2.1)
redis (5.2.0)
redis-client (>= 0.22.0)
redis-client (0.22.1)
redis-client (0.22.2)
connection_pool
regexp_parser (2.9.0)
regexp_parser (2.9.2)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.13.0)
Expand All @@ -233,11 +233,11 @@ GEM
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.63.4)
rubocop (1.64.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -260,7 +260,7 @@ GEM
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.24.0)
rubocop-rails (2.25.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
Expand Down Expand Up @@ -344,6 +344,7 @@ GEM

PLATFORMS
arm64-darwin-22
arm64-darwin-23
arm64-linux
x86_64-linux
x86_64-linux-musl
Expand Down Expand Up @@ -381,4 +382,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.5.6
2.5.11
2 changes: 1 addition & 1 deletion components/s3_mpeg/.tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.2.2
ruby 3.3.1
29 changes: 5 additions & 24 deletions components/s3_mpeg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
# Adopted from https://docs.aws.amazon.com/lambda/latest/dg/images-create.html#images-create-from-alt

# From: https://docs.aws.amazon.com/lambda/latest/dg/images-test.html#images-test-add
# To test an image without adding RIE to the image
#
# mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie \
# https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie \
# && chmod +x ~/.aws-lambda-rie/aws-lambda-rie
#
# For ARM:
#
# https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie-arm64
#
# Run the command
#
# docker run --rm -v ~/.aws-lambda-rie:/aws-lambda -p 9000:8080 \
# --entrypoint /aws-lambda/aws-lambda-rie record_to_mp3:latest \
# /usr/local/bundle/bin/aws_lambda_ric app.App::Handler.process
#
# curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

ARG FUNCTION_DIR="/app"

FROM ruby:3.2-alpine as build-image
ARG RUBY_VERSION=3.3
FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine AS build-image

RUN apk update && \
apk upgrade && \
Expand All @@ -48,7 +27,7 @@ COPY app.rb ${FUNCTION_DIR}

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

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

ARG FUNCTION_DIR
WORKDIR ${FUNCTION_DIR}
Expand All @@ -62,5 +41,7 @@ RUN apk update && \
gem install bundler && \
gem install aws_lambda_ric

ENV RUBY_YJIT_ENABLE=true

ENTRYPOINT [ "/usr/local/bundle/bin/aws_lambda_ric" ]
CMD [ "app.App::Handler.process" ]
14 changes: 8 additions & 6 deletions components/s3_mpeg/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ GEM
remote: https://rubygems.org/
specs:
aws-eventstream (1.3.0)
aws-partitions (1.929.0)
aws-partitions (1.936.0)
aws-sdk-core (3.196.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.81.0)
aws-sdk-kms (1.82.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.151.0)
Expand All @@ -21,7 +21,8 @@ GEM
docile (1.4.0)
jmespath (1.6.2)
ox (2.14.18)
rexml (3.2.5)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand All @@ -31,10 +32,10 @@ GEM
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.0)
rspec-support (3.13.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -44,6 +45,7 @@ GEM
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
strscan (3.1.0)

PLATFORMS
ruby
Expand All @@ -56,4 +58,4 @@ DEPENDENCIES
simplecov-cobertura

BUNDLED WITH
2.4.12
2.5.11
2 changes: 1 addition & 1 deletion components/services/.tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.2.2
ruby 3.3.1
8 changes: 5 additions & 3 deletions components/services/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG FUNCTION_DIR="/function"

FROM ruby:3.2-alpine as build-image
ARG RUBY_VERSION=3.3
FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine AS build-image

RUN apk update && \
apk upgrade && \
Expand Down Expand Up @@ -30,7 +30,7 @@ COPY lib/ ${FUNCTION_DIR}/lib/

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

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

ARG FUNCTION_DIR
WORKDIR ${FUNCTION_DIR}
Expand All @@ -44,5 +44,7 @@ RUN apk update && \
gem install bundler && \
gem install aws_lambda_ric

ENV RUBY_YJIT_ENABLE=true

ENTRYPOINT [ "/usr/local/bundle/bin/aws_lambda_ric" ]
CMD [ "app.App::Handler.process" ]
14 changes: 7 additions & 7 deletions components/services/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
aws-eventstream (1.3.0)
aws-partitions (1.935.0)
aws-partitions (1.936.0)
aws-sdk-core (3.196.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
Expand All @@ -19,13 +19,13 @@ GEM
aws-sigv4 (~> 1.1)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
bigdecimal (3.1.7)
bigdecimal (3.1.8)
coderay (1.1.3)
concurrent-ruby (1.2.3)
concurrent-ruby (1.3.1)
diff-lcs (1.5.1)
docile (1.4.0)
jmespath (1.6.2)
method_source (1.0.0)
method_source (1.1.0)
ox (2.14.18)
pg (1.5.6)
pry (0.14.2)
Expand All @@ -43,10 +43,10 @@ GEM
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.0)
rspec-support (3.13.1)
sentry-ruby (5.17.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand Down Expand Up @@ -81,4 +81,4 @@ DEPENDENCIES
simplecov-cobertura

BUNDLED WITH
2.4.12
2.5.11
41 changes: 0 additions & 41 deletions components/services/spec/support/aws.rb

This file was deleted.

Loading

0 comments on commit bbbb2f7

Please sign in to comment.