# Building the image without touching the database

**URL:** https://meta.discourse.org/t/building-the-image-without-touching-the-database/171454
**Category:** Self-hosting
**Created:** [November 27, 2020, 12:33am UTC](https://meta.discourse.org/t/building-the-image-without-touching-the-database/171454 "2020-11-27T00:33:22Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![simonk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simonk/32/247950_2.png) [@simonk](https://meta.discourse.org/u/simonk)
#### Post date: [November 27, 2020, 8:41am UTC](https://meta.discourse.org/t/building-the-image-without-touching-the-database/171454/2 "2020-11-27T08:41:33Z")

</div>

I wanted to do the same as you - we run discourse on Amazon ECS, so we needed to be able to build just the web image and push it to a registry. I didn’t fancy hacking the discourse build process because we want to stay as close as possible to the supported install.

Instead, we use the normal `launcher` script to build a [two-container setup](https://meta.discourse.org/t/how-to-move-from-standalone-container-to-separate-web-and-data-containers/29413) on a local machine, but ignore the data container and push the web container to the registry. At runtime we override the Postgres and Redis connection details via environment variables.

Deploying the new image is a 3-step process:

1. **Run the safe pre-migrations**. Get ECS to run this command (with the new image):

2. **Deploy the new image**. Update the ECS service.

3. **Run the post-migrations**. Get ECS to run this command:

Having a local data container run while we build the image is probably wasteful, but it means we can use the standard `web.template.yml` without having to worry about which parts try to talk to the database or redis.

---

_[View the full topic](https://meta.discourse.org/t/building-the-image-without-touching-the-database/171454)._
