From 174b51127dc08415e9116d986aa905d8030df7cb Mon Sep 17 00:00:00 2001 From: David Cristofaro Date: Tue, 18 Apr 2023 21:36:18 +1000 Subject: [PATCH] Cleanup --- .dockerignore | 43 ++++--------------------------------------- .gitignore | 15 --------------- Dockerfile | 20 ++++++++------------ 3 files changed, 12 insertions(+), 66 deletions(-) delete mode 100644 .gitignore diff --git a/.dockerignore b/.dockerignore index 9dc7e6a..87838f2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,39 +1,4 @@ -# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files. - -# Ignore git directory. -/.git/ - -# Ignore bundler config. -/.bundle - -# Ignore all default key files. -/config/master.key -/config/credentials/*.key - -# Ignore all environment files. -/.env* -!/.env.example - -# Ignore all logfiles and tempfiles. -/log/* -/tmp/* -!/log/.keep -!/tmp/.keep - -# Ignore pidfiles, but keep the directory. -/tmp/pids/* -!/tmp/pids/ -!/tmp/pids/.keep - -# Ignore storage (uploaded files in development and any SQLite databases). -/storage/* -!/storage/.keep -/tmp/storage/* -!/tmp/storage/ -!/tmp/storage/.keep - -# Ignore assets. -/node_modules/ -/app/assets/builds/* -!/app/assets/builds/.keep -/public/assets +* +!/public/ +!/config.ru +!/Gemfile* diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 4da16e7..0000000 --- a/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -.tags - -/.bundle/ -/.yardoc -/gems.locked -/_yardoc/ -/coverage/ -/doc/ -/pkg/ -/spec/reports/ -/tmp/ - -.rspec_status -.covered.db -/h2spec diff --git a/Dockerfile b/Dockerfile index 2aa0bfb..c3b4c4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,14 @@ -# syntax = docker/dockerfile:1 - -FROM ruby:3.2-alpine - +FROM ruby:3.2-alpine as base WORKDIR /app -RUN apk add build-base +FROM base as build +COPY Gemfile Gemfile.lock . +RUN set -eux; \ + apk add --no-cache build-base; \ + bundle install; -# Install application gems -COPY Gemfile Gemfile.lock ./ -RUN bundle install - -# Copy application code +FROM base as app +COPY --from=build /usr/local/bundle /usr/local/bundle COPY . . - -# Start the server by default, this can be overwritten at runtime EXPOSE 9292 CMD ["puma"]