Skip to content

Commit

Permalink
new problems are new
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Feb 22, 2024
1 parent 23b4656 commit ca4d9dc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.2 AS development
FROM ruby:3.2 AS base

# These build args are in your `.env` file, and they exist so that for
# development the user in the container has the same UID and GID as you.
Expand Down Expand Up @@ -26,17 +26,21 @@ USER app

ENV BUNDLE_PATH /gems

COPY --chown=${UID}:${GID} Gemfile* /app/

WORKDIR /app

CMD ["tail", "-f", "/dev/null"]

FROM base AS development

COPY --chown=${UID}:${GID} Gemfile /app/

# cache mount for bundle install so running bundle install won't reinstall
# everything
RUN --mount=type=cache,target=/gems/bundle,uid=${UID},gid=${GID} \
bundle install

CMD ["tail", "-f", "/dev/null"]

FROM development AS production
FROM base AS production

COPY --chown=${UID}:${GID} . /app

RUN bundle install
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
source "https://rubygems.org"

gem "marc"
gem "rails"

group :development do
gem "pry"
gem "pry-byebug"
Expand Down
2 changes: 2 additions & 0 deletions bundle_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#This builds the gems and updates Gemfile.lock
docker compose build && docker compose run --rm app bundle install

0 comments on commit ca4d9dc

Please sign in to comment.