Closed clupprich closed 1 year ago
Here's a minimal Rails app that shows the issue: https://github.com/clupprich/gcp_buildpacks_test
Thanks for reporting this issue. We'll take a look at it.
I have a change out to fix this. The OSS builder, the one you are using, has not supported Rails asset precompilation till now. Once this change is in, the NodeJS buildpack should be installed.
To work around this issue without the upcoming fix, you can locally run bundle exec ruby bin/rails assets:precompile
and deploy the app. This leads to the asset precompilation being done locally, so the "rails" buildpack will not be executed during app deployment.
The change is in. @clupprich Can you retry your build?
Hm, this isn't yet live on gcr.io/buildpacks/builder, right? Cause the latest
tag there is still from December 13.
Ah right, we have a holiday freeze going on, so the next builder image will be published on 2023-01-03.
There are 2 workarounds for now:
bundle exec ruby bin/rails assets:precompile
) and then create the application image@clupprich IIUC, when you use pack build
to create your app container, you are able to create a container, but since the asset precompilation step has failed, the app is not able to serve some assets?
*For clarification, the latest gcr.io/buildpacks/builder
image will be published on January 3rd, 2023.
@shreejad No worries, I can totally wait those couple of days.
You're right - the image can be built, but assets are missing.
@shreejad Sorry, I forgot about this over the holidays.
So building the example repo with the gcr.io/buildpacks/builder
image works now, the nodejs buildpack gets detected and used:
===> DETECTING
[detector] google.ruby.runtime 0.0.1
[detector] google.ruby.rubygems 0.9.0
[detector] google.ruby.bundle 0.9.0
[detector] google.nodejs.runtime 1.0.0
[detector] google.ruby.rails 0.9.0
[detector] google.config.entrypoint 0.9.0
[detector] google.utils.label 0.0.2
However, when using a custom build image (because I need some more dependencies to build the gem for Postgres), the nodejs buildpack doesn't get detected:
===> DETECTING
[detector] google.ruby.runtime 0.0.1
[detector] google.ruby.rubygems 0.9.0
[detector] google.ruby.bundle 0.9.0
[detector] google.ruby.rails 0.9.0
[detector] google.config.entrypoint 0.9.0
[detector] google.utils.label 0.0.2
That's odd, and I'm wondering what I'm doing wrong. Here's the builder.Dockerfile
I'm using (taken & modified from https://cloud.google.com/docs/buildpacks/build-run-image):
FROM gcr.io/buildpacks/builder
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl-dev libpq-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER cnb
Edit: I was pushing the wrong container image up to the registry, my bad. All good now. Thank you!
I was trying to build a Rails 7 application (with jsbundling-rails installed). While yarn is correctly installed, it fails because there's no version of NodeJS installed:
Here's the complete output of a
pack build -v
(note that I'm using a custom builder image because of packages needed for building thepg
andopenssl
gems):