I have a dockerfile that contains the following steps.
FROM ruby:2.4.5-slim
# more build steps
WORKDIR /app
COPY ./Gemfile ./Gemfile.lock ./package.json ./yarn.lock ./
RUN bundle install
RUN yarn install
COPY . .
RUN RAILS_ENV=production bin/rails assets:precompile --trace
# more build steps
Sometimes the assets will precompile perfectly within a few seconds, other times the precompilation times out. The timeout is consistent with certain builds only on Google Cloud Builder. If I restart a build that timesout, that build will timeout again. I am able to build the image without any issues on many different machines.
I've also been able to successfully run the cloubuild steps locally without any issues.