How can I import assets from outside the Vite root directory in my Astro app?

0
0
Asked By CreativePineapple42 On

I'm running an Astro site on a VPS using Coolify, and I need to access some images stored in an external mounted directory at /mnt/disk. This directory is linked to the Docker container at /external. I've tried various methods to import these images for use with Astro's component, including: 1) using a relative path to ../external, 2) binding /external inside /app/src/assets/, and 3) symlinking /external to /app/src/assets/external. However, none of these approaches work in production, even though I can see the images in the Docker mount and can browse them through the /public directory. I've also experimented with different configurations in my Astro and tsconfig.json, but nothing seems to solve the issue. I'm hoping someone here can offer some insights.

1 Answer

Answered By ImageWhisperer On

I found a workaround! Instead of symlinking, I set up a separate Nginx container to host the images, and now I can access them remotely in my Astro app. It’s working much better this way!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.