shared monorepo dockerfile

nedhmn
TRIALOP

a year ago

hey. i've been going through the docs on this but couldn't find a clear answer for a non-node, shared monorepo, whose all services are defined in dockerfiles.

project/
├── apps/
│   ├── service1/
│   │   ├── data/
│   │   └── tests/
│   └── service2/
│       ├── data/
│       ├── notebooks/
│       └── tests/
├── config/
├── db/
│   ├── migrations/
│   │   └── versions/
│   └── seeds/
├── docker/
│   ├── service1/
│   └── service2/
├── packages/
│   ├── models/
│   ├── types/
│   └── utils/
├── scripts/
└── tests/

here's some directories in my repo. in apps i have all my shared services, and their dockerfiles are in /docker. the services are serverless python functions that i plan to run with cronjob and app sleep in railway.

goal

i want to deploy each service via dockerfile as defined in /docker/, which uses code from the whole repo. whenever changes are made to a service's dockerfile, to deploy to railway.

guess

i've read in this forum that railway.json are scoped to 1 service. so maybe inside of /docker/service[x]/, along with my Dockerfile have a railway.json that specifies watch files? making this path the root dir of service?

Solved

0 Replies

nedhmn
TRIALOP

a year ago

N/A


a year ago

I think you may want to set the dockerfile location with an env var?


a year ago

you would of course not set a root directory and deploy multiple services for the multiple apps you want to deploy


nedhmn
TRIALOP

a year ago

yes that works


a year ago

does that also mean you were able to get your project stood up?


nedhmn
TRIALOP

a year ago

yes. but i did it all on the gui. i have a config-as-code followup.
for the solution u gave me, that's just this part of the railway.json, yes?

{
  "$schema": "https://railway.com/railway.schema.json",
  "build": {
    "dockerfilePath": "Dockerfile.backend"
  }
}

i think i've seen an input in service settings where i can specify the location of the railway config file, if i wanted to interact with gui i'd just put the path there and the rest can be defined in the json? and i'd need a different railway.json file per service? would i just put that in the corresponding /docker/service[x]/ dir alongside the Dockerfile?


a year ago

can you share why you want to go to the config file route given you are only needing to set a single setting, vs setting a service variable per my recommendation, your method is far more involved


nedhmn
TRIALOP

a year ago

i would've liked to have all of these things defined in my repo. i also didn't mind learning about it.


a year ago

hmmm but you can't define the railway.json path in your repo so it's kinda the same problem, just now you have an extra unneeded file


nedhmn
TRIALOP

a year ago

yes. i suppose going all the way is more effort than i'd like. this will do for now then! thanks.


a year ago

no problem!


a year ago

!s


Status changed to Solved brody 11 months ago


Loading...