Skip to content

Image pack locations different between machines #2899

@aldent95

Description

@aldent95

I'm currently working on converting one of my older websites to using just Webpacker and no Sprokets or old asset pipeline, but I've come across a weird issue that I can't seem to resolve.

I've followed guides as best I can for doing my images, and everything was working fine with the image_pack_tag for my .html.erb files on my local environment. I.E. <%= image_pack_tag 'media/slider/slider-1.jpg', class: 'responsive-img' %>

And the images being used are stored as below
image

As I said, this works fine on my local windows machine, both Dev, Prod and Prod assets:precompile

However when I push my code to Gitlab and have it built on a Linux VM, the pack paths change.
On my local I get the following in the manifest

  "media/slider/slider-1.jpg": "/packs/media/slider/slider-1-766084b0.jpg",
  "media/slider/slider-2.jpg": "/packs/media/slider/slider-2-49b9ae0c.jpg",
  "media/slider/slider-3.jpg": "/packs/media/slider/slider-3-32360107.jpg",
  "media/slider/slider-4.jpg": "/packs/media/slider/slider-4-6e14e879.jpg",
  "media/slider/slider-5.jpg": "/packs/media/slider/slider-5-e84f0a70.jpg",

But on the Linux build for prod I get the following


"media/images/slider/slider-5.jpg": "/packs/media/images/slider/slider-5-e84f0a7087263e5ba7f897dccc75ed98.jpg",
"media/images/slider/slider-4.jpg": "/packs/media/images/slider/slider-4-6e14e87967b11680d18c07ada4dc802a.jpg",
"media/images/slider/slider-3.jpg": "/packs/media/images/slider/slider-3-323601072f43c7e6dfbd3f668a29de9b.jpg",
"media/images/slider/slider-2.jpg": "/packs/media/images/slider/slider-2-49b9ae0ccfe0c9ea411bf0b56ee7fec6.jpg",
"media/images/slider/slider-1.jpg": "/packs/media/images/slider/slider-1-766084b0f3f37b461846e91b9c953d17.jpg",

It has the extra /images/ in it which is causing issues with all my tags in my code as they no longer point to the right files.

I've done everything I can think off to try and fix this but I'm not making any progress. Originally I thought it was a Dev vs Prod config issue but the prod manifest on my local machine is the same as the dev manifest. It's only once Gitlab builds it that it ends up different.

If anyone has any ideas I'd gladly try them as this is driving me mad.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions