yassinedoghri / astro-i18next

An astro integration of i18next + some utility components to help you translate your astro websites!
https://astro-i18next.yassinedoghri.com
MIT License
502 stars 38 forks source link

Path mismatch if Astro runs in docker #144

Open darioguarascio opened 1 year ago

darioguarascio commented 1 year ago

Describe the bug

After a build and having Astro running in a containerized way, translation do not work because the build generates:

....
"backend": {"loadPath": "/some/local/directory/public/locales/{{lng}}/{{ns}}.json",}
....

and docker uses mounting point, therefore path mismatch

To Reproduce

run a Astro build with npm run build run npm run preview to have the server being executed in local machine -> in this way, it works

use this docker-compose.yml sample to run the same server but within a docker container:

  astro:
    image: node:18
    restart: unless-stopped
    volumes:
      - ./:/app
    working_dir: /app
    ports:
      - 127.0.0.1:3000:3000/tcp
    command: node ./dist/server/entry.mjs