testing cache
This commit is contained in:
parent
9c02449634
commit
d9e592a985
1 changed files with 9 additions and 14 deletions
19
Dockerfile
19
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,9 +19,8 @@ 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 && \
|
||||
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
|
||||
|
|
@ -35,9 +33,8 @@ 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 && \
|
||||
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
|
||||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue