Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to skip css:build during assets:precompile #99

Merged
merged 4 commits into from
Jan 9, 2023

Conversation

ylecuyer
Copy link
Contributor

Hello,

I was playing with a dockerfile like this:

FROM node:18-alpine as builder
        
WORKDIR /src
COPY package.json /src
COPY yarn.lock /src
RUN yarn install
    
COPY . /src
    
RUN yarn build:css
      
FROM ruby:3.0.4
  
WORKDIR /src

COPY Gemfile .
COPY Gemfile.lock .

RUN bundle install
  
COPY . .
  
COPY --from=builder /src/app/assets/builds/application.css /src/app/assets/builds/
RUN bundle exec rails assets:precompile

EXPOSE 3000

CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]

And I was getting this error:

Step 16/18 : RUN bundle exec rails assets:precompile
 ---> Running in b268b243b355
sh: 1: yarn: not found
rails aborted!
cssbundling-rails: Command css:build failed, ensure yarn is installed and `yarn build:css` runs without errors or add SKIP_YARN

Tasks: TOP => assets:precompile => css:build
(See full trace by running task with --trace)

In this case it makes no sense as the css:build has already be done and the final docker image is free of node/yarn, that's why I'm proposing this CSS_BUILD=false similar to WEBPACKER_PRECOMPILE=false in https://github.com/rails/webpacker/blob/f1b06c7fd5bc4b7fc7128742d1078466b94af71f/lib/tasks/webpacker/compile.rake#L37 to skip the css:build.

@ylecuyer ylecuyer changed the title Add possibility to skip yarn during assets:precompile Add possibility to skip css:build during assets:precompile Jul 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants