kamal
kamal copied to clipboard
/bin/rails assets:precompile" did not complete successfully: exit code: 1 randomly fails
Hi,
I saw there was a similar issue in the past regarding this error when precompiling assets. It was suggested that it was a Ruby issue and recommended to wait until Ruby 3.3.1 is released.
In my case, this issue is still happening with the following setup:
Ruby 3.3.1
Kamal 1.7.0
Rails 7.1.3
When running kamal deploy -d staging, I eventually get the following error:
------
kamal-backoffice-service.dockerfile:45
--------------------
43 | # SECRET_KEY_BASE_DUMMY=1 RAILS_MASTER_KEY=$RAILS_MASTER_KEY ./bin/rails assets:precompile
44 |
45 | >>> RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
46 |
47 | # Final stage for app image
--------------------
ERROR: failed to solve: process "/bin/sh -c SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile" did not complete successfully: exit code: 1
When I run the docker-compose, the whole process works, but running kamal deploy fails. I've also tried to pass the RAILS_MASTER_KEY as an argument into the build process, but it keeps failing:
# Set up a secret mount and precompile assets
RUN --mount=type=secret,id=RAILS_MASTER_KEY \
RAILS_MASTER_KEY=$(cat /run/secrets/RAILS_MASTER_KEY) && \
SECRET_KEY_BASE_DUMMY=1 RAILS_MASTER_KEY=$RAILS_MASTER_KEY ./bin/rails assets:precompile
Is anyone else facing the same situation?