feat: Add Dockerfile and Docker Compose configuration for containerized deployment and update README with instructions.

This commit is contained in:
2026-03-03 19:19:47 +00:00
parent bfcf45343f
commit b93d4548d4
3 changed files with 91 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ sqlx database create
```
*(Optionally run migrations if any exist: `sqlx migrate run`)*
## Running the app
To start the server, simply run:
@@ -36,3 +37,34 @@ cargo run
```
Then, open your web browser and navigate to `http://localhost:3000` (or whichever port you configured).
## Run with Docker
You can also run this project using Docker.
### Using Docker Compose (Recommended)
To start the application and its dependencies (like the database and attachment storage):
```bash
docker-compose up -d --build
```
The application will be accessible at `http://localhost:3000`. Persistent data (the database and attachments) will be stored in the local directory.
### Using Docker Directly
1. Build the image:
```bash
docker build -t blog-cms .
```
2. Run the container:
```bash
docker run -d \
-p 3000:3000 \
-v $(pwd)/data.db:/app/data.db \
-v $(pwd)/attachments:/app/attachments \
--name blog-cms \
blog-cms
```