# Custom code run after app building in app.yml file

**URL:** https://meta.discourse.org/t/custom-code-run-after-app-building-in-app-yml-file/283644
**Category:** Self-hosting
**Created:** [October 27, 2023, 8:03am UTC](https://meta.discourse.org/t/custom-code-run-after-app-building-in-app-yml-file/283644 "2023-10-27T08:03:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Hitesh\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hitesh_sharma/32/309992_2.png) [@Hitesh\_Sharma](https://meta.discourse.org/u/Hitesh_Sharma)
#### Post date: [October 27, 2023, 8:03am UTC](https://meta.discourse.org/t/custom-code-run-after-app-building-in-app-yml-file/283644/1 "2023-10-27T08:03:13Z")

</div>

Hi @Discourse  
Can I run a custom code in the app.yml file when rebuilding the app??

> <https://github.com/discourse/discourse_docker/blob/main/samples/standalone.yml>

## Any custom commands to run after building

run:

- exec:  
cd: /var/discourse  
cmd:  
- /var/discourse/rebuild/apply.sh

# Apply.sh file content:-

docker cp ./rebuild/static\_controller.rb app:/var/www/discourse/app/controllers/static\_controller.rb

docker cp ./rebuild/routes.rb app:/var/www/discourse/config/routes.rb

docker cp ./rebuild/site\_settings.yml app:/var/www/discourse/config/site\_settings.yml

./launcher restart app

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [October 27, 2023, 12:19pm UTC](https://meta.discourse.org/t/custom-code-run-after-app-building-in-app-yml-file/283644/2 "2023-10-27T12:19:23Z")

</div>

Are you sure you want to overwrite those files wholesale rather than modify them?

---

<div class="post-metadata">

### Author: ![Hitesh\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hitesh_sharma/32/309992_2.png) [@Hitesh\_Sharma](https://meta.discourse.org/u/Hitesh_Sharma)
#### Post date: [October 27, 2023, 12:20pm UTC](https://meta.discourse.org/t/custom-code-run-after-app-building-in-app-yml-file/283644/3 "2023-10-27T12:20:53Z")

</div>

yes @Stephen, I am sure to rewrite these files

I also run the patch command after rebuilding the app then they copy the file to docker images

# /rebuild/apply.sh

But I am curious to execute custom code in the app.yml file

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 30, 2023, 10:30pm UTC](https://meta.discourse.org/t/custom-code-run-after-app-building-in-app-yml-file/283644/4 "2023-10-30T22:30:04Z")

</div>

I think that will do what you want.

You’d be better off solving your problem auth a plugin.
