Skip to content

Commit

Permalink
Fix nat instance health checker (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie authored Sep 18, 2024
1 parent 6fa786e commit 7248bb1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
terraform 1.8.2
ruby 3.3.1
ruby 3.3.5
Original file line number Diff line number Diff line change
@@ -1,48 +1,31 @@
ARG FUNCTION_DIR="/function"
ARG RUBY_VERSION=3.3
FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine AS build-image

RUN apk update && \
apk upgrade && \
apk add --update --no-cache build-base
# syntax=docker/dockerfile:1.7-labs

RUN gem install bundler
ARG RUBY_VERSION=3.3
FROM public.ecr.aws/lambda/ruby:$RUBY_VERSION AS build-image

ARG FUNCTION_DIR
RUN mkdir -p ${FUNCTION_DIR}
COPY Gemfile Gemfile.lock ${FUNCTION_DIR}/
WORKDIR ${FUNCTION_DIR}
RUN dnf update && \
dnf -y install gcc make

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

RUN bundle config --local deployment true && \
RUN gem install bundler && \
bundle config --local deployment true && \
bundle config --local path "vendor/bundle" && \
bundle config --local without 'development test'

RUN bundle install --jobs 20 --retry 5
bundle config --local without 'development test' && \
bundle install

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 config/ ${FUNCTION_DIR}/config/

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

FROM public.ecr.aws/docker/library/ruby:$RUBY_VERSION-alpine
COPY app.rb ${LAMBDA_TASK_ROOT}/
COPY app/ ${LAMBDA_TASK_ROOT}/app/
COPY --exclude=*.key config/ ${LAMBDA_TASK_ROOT}/config/

ARG FUNCTION_DIR
WORKDIR ${FUNCTION_DIR}
# #############################

ENV BUNDLE_APP_CONFIG="${FUNCTION_DIR}/.bundle"
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR}
FROM public.ecr.aws/lambda/ruby:$RUBY_VERSION

RUN apk update && \
apk upgrade && \
gem install bundler && \
gem install aws_lambda_ric
COPY --from=build-image ${LAMBDA_TASK_ROOT} ${LAMBDA_TASK_ROOT}

ENV RUBY_YJIT_ENABLE=true

ENTRYPOINT [ "/usr/local/bundle/bin/aws_lambda_ric" ]
CMD [ "app.App::Handler.process" ]
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@ group :development do
end

group :test do
gem "pry"
gem "rspec"
gem "simplecov", require: false
gem "simplecov-cobertura", require: false
end
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,27 @@ GEM
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.2.0)
bigdecimal (3.1.8)
coderay (1.1.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
diff-lcs (1.5.1)
docile (1.4.1)
drb (2.2.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.2)
language_server-protocol (3.17.0.3)
logger (1.6.1)
method_source (1.1.0)
minitest (5.25.1)
ox (2.14.18)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.8.1)
rack (3.1.7)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rexml (3.3.7)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand Down Expand Up @@ -104,15 +97,6 @@ GEM
rubocop-rails
ruby-progressbar (1.13.0)
securerandom (0.3.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
Expand All @@ -126,12 +110,9 @@ DEPENDENCIES
aws-sdk-cloudwatch
aws-sdk-ec2
ox
pry
rake
rspec
rubocop-rails-omakase
simplecov
simplecov-cobertura

BUNDLED WITH
2.5.18
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Dir["#{File.dirname(__FILE__)}/**/*.rb"].sort.each { |f| require f }
Dir["#{File.dirname(__FILE__)}/../app/**/*.rb"].sort.each { |f| require f }
Dir["#{File.dirname(__FILE__)}/**/*.rb"].each { |f| require f }
Dir["#{File.dirname(__FILE__)}/../app/**/*.rb"].each { |f| require f }
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@
# Kernel.srand config.seed
end

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

0 comments on commit 7248bb1

Please sign in to comment.