Skip to content

Commit

Permalink
docs: update Container-README.md with Docker build and run instructio…
Browse files Browse the repository at this point in the history
…ns for rust-backend
  • Loading branch information
lmcdonough committed Nov 8, 2024
1 parent 5dfa882 commit 6a2a33c
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion docs/runbooks/Container-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,43 @@ Before you begin, ensure you have the following installed:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_HOST: ${POSTGRES_HOST}
ports:
- "${WEB_PORT}:8080"
- "${WEB_PORT}:4000"
depends_on:
- postgres
```
## Building and Running the Application
### **1. Building the rust-backend image**
To build the Docker image for the Rust application, run the following command:
```bash
docker buildx build --platform linux/amd64,linux/arm64 -t rust-backend .
```

- this will build the image for both amd64 and arm64 architectures or you can choose to build for a specific architecture by specifying the `--platform` flag.
- the image will be tagged as `rust-backend` and will be used in the `docker-compose.yaml` file.

### **2. Running the Rust Backend Application**

**Interactive Shell Access to Functions:** When you start the container the default behavior is to enter an interactive session, both the binaries and each of the functions from rebuild_db.sh are immediately available:

```bash
docker run -it rns-backend:latest
```

- Inside the container shell, you can directly call any function from `rebuild_db.sh` directly by name:
- You can also run any of the binaries or functions from `rebuild_db.sh` directly by name as arguments to the `docker run` command:

```bash
docker run -it rns-backend:latest seed_db
```

## Building and Running the Entire Application

To build and run the entire application, including the Rust backend and PostgreSQL database, follow these steps:

### **Step 1: Build the Docker images**

From the project root, run the following command to build the Docker images for both the Rust application and PostgreSQL (if running locally).
Expand Down

0 comments on commit 6a2a33c

Please sign in to comment.