After introducing gitignore I lost my dist files in the docker image
Once I added my dist files into gitignore it seems like docker build also ignores those files. Can I somehow override it using dockerignore and ! syntax?
30 Replies
Project ID:
N/A
I couldn't find anything related to it in nixpacks docs and neither here
92ff0446-98a5-4e3f-ad73-86d8ecb2e044
I am using turborepo and nixpacks
maybe something liek that could help?
@medim would you happen to know what they're talking about?
weird... But cant u simply just ignore the dist dir and rebuild it on docker?
idk if i understand it correctly, but they add the built monorepo (dist folder) to the gitignore but docker also ignored that, that is how it works since builds are based on the repo and that folder isnt on the repo
I don't understand it either
🙂
OK I'll try to explain
I'am trying to create a shared monorepo project for directus as a backend and nextjs as a front-end.
This is the repo: https://github.com/tomaswitek/directus-monorepo
GitHub
GitHub - tomaswitek/directus-monorepo: Directus Monorepo
Directus Monorepo. Contribute to tomaswitek/directus-monorepo development by creating an account on GitHub.
There are 2 railway templates for directus, but none of them does it as a monorepo
I decided to go with turborepo as a monorepo
The main issue is deploying a directus extensions: https://docs.directus.io/extensions/introduction.html
Extensions | Directus Docs
Discover how Directus extensions enable you to expand its features and how you can customize it to suit your specific needs.
Directus can be extended using extensions, every extension is basically a separate node module
Here is an example of a simple directus extension: https://github.com/tomaswitek/directus-monorepo/tree/main/packages/directus-extensions/endpoints/endpoint-example
GitHub
directus-monorepo/packages/directus-extensions/endpoints/endpoint-e...
Directus Monorepo. Contribute to tomaswitek/directus-monorepo development by creating an account on GitHub.
I want to use railway only for the apps/directus, the web will be deployed by vercel. So please ignore the web part.
By running
build:railway
I want to build the extensions located in packages
folder and then start the directus. The dist files are located directly in the root of every extension.index.js is the compiled version of an extension. index.js is also listed in gitignore, because I want to have only source code in the git repo.
looks like you know how to get railway to run your desired build and start commands, so this is seeming more like a turborepo / pnpm question?
these threads are generally intended for help with railway, your question is more so about node / turbo / pnpm, and thus I think your question would be better served in one of those communities, or by further familiarising yourself with the technologies involved
I think it is related to railway because I found couple of similar questions and it was never answered 😦
in the build step the index.js file is generated
it is removed when deployed
haha there's lots of questions that don't relate to railway
you're probably looking in the wrong directory
ok I give up
wanted to create a template for the community
railway isn't removing the file, something you're doing is removing the file, I suggested for the familiarising yourself with the technologies you are using
if I knew the problem id tell you
thank you
it is cache related btw.
I will post an answer once I'll figure it out
sounds good
So exactly as I thought at the beggining: .dockerignore was missing
The thing is, the bad version of image was already cached, and simply adding a .dockerignore file didn't help. Once I changed something in package.json it started to work.
gotcha
Wow great tip about the .dockerignore! We are also using Turborepo with Medusa Js and have some plugins inside the packages/ directory which were left out. Putting a .dockerignore with
!/dist
prevented the removal of the builded code from these packages.@Pepijn btw. how did you get your
pro plan
role? I also have a pro plan. Is there a way how to connect discord account to railway account?Yeah, I connected Discord from the account settings in Railway