R
Railway•13mo ago
krissott

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
Percy
Percy•13mo ago
Project ID: N/A
krissott
krissott•13mo ago
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
[phase.build]
paths = ['/app/packages/directus-extensions/*/*/*.*js']
[phase.build]
paths = ['/app/packages/directus-extensions/*/*/*.*js']
maybe something liek that could help?
Brody
Brody•13mo ago
@medim would you happen to know what they're talking about?
Medim
Medim•13mo ago
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 thonk
Brody
Brody•13mo ago
I don't understand it either
krissott
krissott•13mo ago
🙂 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.
krissott
krissott•13mo ago
GitHub
GitHub - tomaswitek/directus-monorepo: Directus Monorepo
Directus Monorepo. Contribute to tomaswitek/directus-monorepo development by creating an account on GitHub.
krissott
krissott•13mo ago
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
krissott
krissott•13mo ago
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.
krissott
krissott•13mo ago
Directus can be extended using extensions, every extension is basically a separate node module
krissott
krissott•13mo ago
GitHub
directus-monorepo/packages/directus-extensions/endpoints/endpoint-e...
Directus Monorepo. Contribute to tomaswitek/directus-monorepo development by creating an account on GitHub.
krissott
krissott•13mo ago
I want to use railway only for the apps/directus, the web will be deployed by vercel. So please ignore the web part.
No description
krissott
krissott•13mo ago
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.
krissott
krissott•13mo ago
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.
No description
Brody
Brody•13mo ago
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
krissott
krissott•13mo ago
I think it is related to railway because I found couple of similar questions and it was never answered 😦
krissott
krissott•13mo ago
in the build step the index.js file is generated
No description
krissott
krissott•13mo ago
it is removed when deployed
No description
Brody
Brody•13mo ago
haha there's lots of questions that don't relate to railway you're probably looking in the wrong directory
krissott
krissott•13mo ago
ok I give up wanted to create a template for the community
Brody
Brody•13mo ago
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
krissott
krissott•13mo ago
thank you it is cache related btw. I will post an answer once I'll figure it out
Brody
Brody•13mo ago
sounds good
krissott
krissott•13mo ago
So exactly as I thought at the beggining: .dockerignore was missing
krissott
krissott•13mo ago
No description
krissott
krissott•13mo ago
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.
Brody
Brody•13mo ago
gotcha
Pepijn
Pepijn•12mo ago
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.
krissott
krissott•12mo ago
@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?
Pepijn
Pepijn•12mo ago
Yeah, I connected Discord from the account settings in Railway
Want results from more Discord servers?
Add your server