Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Sep 16, 2024
1 parent 99a3846 commit 3813f12
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
{
"identifier": "switch-services-staging",
"environment": "staging",
"branch": "develop",
"branch": "fix_s3mpeg_lambda",
"friendly_image_tag": "beta",
"image_tag": "stag-${{ github.sha }}"
},
Expand Down
8 changes: 8 additions & 0 deletions components/s3_mpeg/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ def initialize(event:, context:, s3_client: Aws::S3::Client.new)
end

def process
begin
1 / 0
rescue ZeroDivisionError => exception
Sentry.capture_exception(exception)
end

Sentry.capture_message("test message")

tempfile do |raw_file|
s3_client.get_object(bucket:, key:, response_target: raw_file.path)

Expand Down
22 changes: 6 additions & 16 deletions components/services/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
# syntax=docker/dockerfile:1.7-labs

ARG FUNCTION_DIR="/function"
ARG RUBY_VERSION=3.3
FROM public.ecr.aws/lambda/ruby:$RUBY_VERSION AS build-image

RUN dnf update && \
dnf -y install postgresql-devel openssl-devel gcc make

ARG FUNCTION_DIR
RUN mkdir -p ${FUNCTION_DIR}
COPY Gemfile Gemfile.lock ${FUNCTION_DIR}/
WORKDIR ${FUNCTION_DIR}

ENV BUNDLE_APP_CONFIG="${FUNCTION_DIR}/.bundle"
COPY Gemfile Gemfile.lock ${LAMBDA_TASK_ROOT}/

RUN gem install bundler && \
bundle config --local deployment true && \
Expand All @@ -22,20 +16,16 @@ RUN gem install bundler && \

RUN rm -rf vendor/bundle/ruby/*/cache/ && find vendor/ -name "*.o" -delete && find vendor/ -name "*.c"

COPY app.rb ${FUNCTION_DIR}
COPY app/ ${FUNCTION_DIR}/app/
COPY --exclude=*.key config/ ${FUNCTION_DIR}/config/
COPY lib/ ${FUNCTION_DIR}/lib/
COPY app.rb ${LAMBDA_TASK_ROOT}/
COPY app/ ${LAMBDA_TASK_ROOT}/app/
COPY --exclude=*.key config/ ${LAMBDA_TASK_ROOT}/config/
COPY lib/ ${LAMBDA_TASK_ROOT}/lib/

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

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}
COPY --from=build-image ${LAMBDA_TASK_ROOT} ${LAMBDA_TASK_ROOT}

RUN dnf update && \
dnf -y install postgresql-devel
Expand Down
2 changes: 1 addition & 1 deletion 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.974.0)
aws-partitions (1.975.0)
aws-sdk-core (3.205.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
Expand Down
4 changes: 2 additions & 2 deletions components/services/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require "bundler"
Bundler.require(:default)

Dir["#{File.dirname(__FILE__)}/../lib/**/*.rb"].each { |f| require f }

require_relative "app_settings"
require_relative "initializers/aws_stubs"

Dir["#{File.dirname(__FILE__)}/../lib/**/*.rb"].each { |f| require f }

EncryptedEnvironmentVariables.new.decrypt

Dir["#{File.dirname(__FILE__)}/**/*.rb"].each { |f| require f }
Expand Down

0 comments on commit 3813f12

Please sign in to comment.