diff --git a/Dockerfile b/Dockerfile index 744302f..0a9f2cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,6 @@ ARG COMMIT_SHA ARG COMMIT_MESSAGE -ARG nothing # Make sure RUBY_VERSION matches the Ruby version in .ruby-version ARG RUBY_VERSION=3.2.4 @@ -20,10 +19,9 @@ FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base WORKDIR /rails # Install base packages -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt update -qq && apt-get --no-install-recommends install -y curl libjemalloc2 libvips libpq-dev nodejs telnet imagemagick && \ - rm -rf /var/lib/apt/lists /var/cache/apt/archives +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips libpq-dev nodejs telnet imagemagick && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment ENV RAILS_ENV="production" \ @@ -35,10 +33,9 @@ ENV RAILS_ENV="production" \ FROM base AS build # Install packages needed to build gems and node modules -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt update -qq && apt-get --no-install-recommends install -y build-essential git libyaml-dev node-gyp pkg-config python-is-python3 && \ - rm -rf /var/lib/apt/lists /var/cache/apt/archives +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y build-essential git libyaml-dev node-gyp pkg-config python-is-python3 && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install JavaScript dependencies ARG NODE_VERSION=22.16.0 @@ -51,16 +48,13 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz # Install application gems COPY Gemfile Gemfile.lock ./ -RUN --mount=type=cache,target=/root/.gem \ - bundle install && \ +RUN bundle install && \ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ bundle exec bootsnap precompile --gemfile # Install node modules COPY package.json yarn.lock ./ -ENV YARN_CACHE_FOLDER=/root/.yarn-cache -RUN --mount=type=cache,target=/root/.yarn-cache \ - yarn install --immutable +RUN yarn install --immutable # Copy application code COPY . . @@ -71,6 +65,7 @@ RUN bundle exec bootsnap precompile app/ lib/ # Precompiling assets for production without requiring secret RAILS_MASTER_KEY RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile + RUN rm -rf node_modules