We've moved discussions to Discord

Error when using RAILS_ENV=production and asset precompilation. Cannot find css file(s)

Sean Drumm
So I'm deploying to DO's new app platform.

Switched to use Rails production like so:
Env vars set (in addition to correct MASTER_KEY and REDIS_URL):
- RAILS_ENV=production
- NODE_ENV=production

Added this line to the Dockerfile, without it there is no manifest generated:
RUN bundle exec rails assets:precompile

No errors during build

Runtime error:
Error during failsafe response: Webpacker can't find application.css in /app/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
   unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
  "administrate.js": "/packs/js/administrate-0edde724927473104dcd.js",
  "administrate.js.map": "/packs/js/administrate-0edde724927473104dcd.js.map",
  "application.js": "/packs/js/application-c7d1a33909a8782ba56e.js",
  "application.js.map": "/packs/js/application-c7d1a33909a8782ba56e.js.map",
  "entrypoints": {
    "administrate": {
      "js": [
        "/packs/js/administrate-0edde724927473104dcd.js"
      ],
      "js.map": [
        "/packs/js/administrate-0edde724927473104dcd.js.map"
      ]
    },
    "application": {
      "js": [
        "/packs/js/application-c7d1a33909a8782ba56e.js"
      ],
      "js.map": [
        "/packs/js/application-c7d1a33909a8782ba56e.js.map"
      ]
    },
    "jumpstart": {
      "js": [
        "/packs/js/jumpstart-241342bcacae35df01ad.js"
      ],
      "js.map": [
        "/packs/js/jumpstart-241342bcacae35df01ad.js.map"
      ]
    }
  },
  "jumpstart.js": "/packs/js/jumpstart-241342bcacae35df01ad.js",
  "jumpstart.js.map": "/packs/js/jumpstart-241342bcacae35df01ad.js.map",
  "media/images/icons/checkmark.svg": "/packs/media/images/icons/checkmark-94d128efd051661a94df22e517d9e626.svg",
  "media/stylesheets/icons/person.svg": "/packs/media/stylesheets/icons/person-3f49afb7a45c25f853507b0576fa783f.svg",
  "media/stylesheets/icons/twitter.svg": "/packs/media/stylesheets/icons/twitter-9cee238b819e63cb331309e217986742.svg"
}
Sean Drumm
Update: I ditched the Dockerfile and using buildpacks avoids the issue. 

I got quite far using `ARG ...` in the Dockerfile but couldn't quite fix assets and packs.
John Chambers
Had the exact same issue when trying to experiment for first time with Docker and DO App platform.

Tried for hours with no luck. Deploying builds just takes so long!

I'd love to understand the major benefits of Docker if someone can explain?

Also would be great to have JSP work on the DO App platform if anyone knows how we should modify the App or Dockerfile?

Looking forward to learning more.

Jake Smith
I've been seeing this same exact error in development as well, on occasion.  I don't know what to make of it.

Docker is a pain in the butt, I agree.  But the main reason why it exists is: consistency between how things are built and run in development and production.  If you develop with docker, you are developing in the same environment your production application will be running in.
John Chambers
Thanks  Jake Smith  

I'm not currently developing with Docker locally so probably less relevant to me currently.

Appreciate the insight :)

Sean Drumm
Hey John Chambers 👋

The easiest way to deploy to DO App platform is to delete or rename your Dockerfile so DO doesn’t insist on using it for builds. Once you do this, it will recognize your code base as a Rails app and use the build pack. You may need to delete and re-add the component if you have an existing App.

This does mean builds are pretty slow though for now.


Source
John Chambers
Thanks a mill  Sean Drumm  I'll try that out! 🥳
Notifications
You’re not receiving notifications from this thread.