From b8dd94685d2bb93a1ce457e182b80c4575fba819 Mon Sep 17 00:00:00 2001 From: Gleb Sinyavskiy Date: Fri, 10 Feb 2023 00:12:44 +0100 Subject: [PATCH] Dockerize app --- .dockerignore | 5 +++++ Dockerfile | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..466b410 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +vendor/ +spec/ +.github/ +coverage/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..27e5ef4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM ruby:3.2.0-slim as base + +WORKDIR /mnt + +RUN adduser --system app &&\ + bundle config --local path vendor/bundle &&\ + bundle config set --local deployment 'true' &&\ + bundle config set --local without 'development test' + +RUN apt-get update &&\ + apt-get install -qy --no-install-recommends git + + +FROM base as builder + +RUN apt-get update &&\ + apt-get install -qy --no-install-recommends build-essential + +COPY Gemfile Gemfile.lock ./ +RUN bundle install + +FROM base + +COPY --from=builder /mnt/vendor . + +ADD . . + +USER app + +CMD ["bundle", "exec", "./exe/nats_streamer", "/config.yaml", "$PATH"]