Closed unlistedhenri closed 1 year ago
It would be very useful if we could specify working directory!
As a workaround, I tried several settings. But some of the settings I could easily come up with did not work.
First, when I set cd myapp && npm start
as the start command, the health check failed and I could not check the application log.
Since &&
may not be interpreted, next I tried sh -c 'cd myapp && npm start'
as the start command. But this still resulted in a health check error. The application log showed unexpected EOF while looking for matching `''
. Similarly, sh -c "cd myapp && npm start"
also resulted error with unexpected EOF while looking for matching `"'
.
The only way that succeeded was mv . /myapp/*; npm ci
as the build command with npm start
as the start command.
Hi @os1ma,
I can confirm App Runner in its current state this is not possible. I understand one of the usecase here is to perform cd
to a sub directory and then execute the actual start command (like npm start
) specifically to support mono repo, have you come across any other usecases that can benefit by allowing this in future? If so we would love to hear about it. Thanks
We ended up not being able to use any kind of cd subfolder && start
technique successfully - our build would fail every time. Instead, our "workaround" ended up being that we created a barebones Docker container for our API and deployed it separately. I would imagine having better subfolder support could potentially eliminate some of these complications. While we're more than happy with the Docker solution, I would imagine some users have a good reason for needing an alternative.
Hi @hariohmprasath,
Changing to sub directory would only help in the case of mono repo. Certainly, it is possible to create our own Docker container image as a workaround. But one of the advantage of App Runner is that we don't have to write a Dockerfile to use it. So it would be wonderful if changing to sub directory were supported.
Temporarily, it would be nice if the documentation mentioned that we can't use cd
with the start command, as it was difficult to troubleshoot that cd myapp && npm start
didn't work.
Following this after a day of trying to get up and running with Source code repository. Would be extremely useful to be able to set a working dir in for monorepos / yarn workspaces. Any mention of this in the docs would also be useful, as it can't be done at the moment.
I was able to get a monorepo working in App Runner with the following scripts in my package.json
:
"scripts": {
"build": "cd app; npm run build",
"serve": "cd app; npm run serve",
},
Using cd
in the npm scripts essentially sets the CWD.
Hello everyone, Thank you for your feedback. We are actively looking into supporting this capability in App Runner. We have some follow-up questions that will help us design this capability in a way that meets your use cases and requirements. Looking forward to your responses.
Hello everyone, Thank you for your feedback. App Runner now supports the ability to define source directory to execute build and run commands. See the What's New blog post and the deep dive blog post for more details.
Community Note
It would be excellent to have better monorepo support - in other words, allowing us to specify a subfolder when configuring a new app runner service. While it's true that you can simply specify to cd into the folder in the configuration file before running build/start commands, I'd rather have this step set up beforehand so only that specific folder is touched.
Apologies if this has been mentioned somewhere, but haven't found anything in documentation or this roadmap. Thanks!