Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Docker Compose support and update documentation #3554

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,34 @@ After cloning repository to your local, perform the following steps from the roo

Now you're running AsyncAPI website in a development mode. Container is mapped with your local copy of the website. Whenever you make changes to the code, the website will refresh and changes visible in localhost:3000.

### Run locally using Docker Compose

#### Prerequisites

- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose](https://docs.docker.com/compose/install/)

After cloning the repository to your local system, you can use Docker Compose to simplify the development setup.

#### Steps
1. Start the development environment with Docker Compose:
```bash
docker-compose up
```

2. Access the website:
- Open your browser and navigate to [http://localhost:3000](http://localhost:3000).

#### Features
- The `docker-compose.yml` file automatically sets up the container and maps your local code to the container's `/async` directory.
- Any changes you make locally will automatically be reflected in the running application due to volume mounting.
- The `node_modules` directory inside the container is isolated to prevent conflicts with your local system.

To stop the container, press `Ctrl+C` in your terminal or run:
```bash
docker-compose down


## Use shared Markdown fragments

To minimize the duplication of content and make it easier to maintain, there are shared fragments you can use when working with Markdown files. These fragments are stored in the `/assets/docs/fragments` directory.
Expand Down
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3.8'

services:
app:
container_name: asyncapi-website # For easier container identification
build:
context: .
dockerfile: Dockerfile # Path to Dockerfile
ports:
- "3000:3000" # Map host port 3000 to container port 3000
volumes:
- .:/async # Mount the current directory to /async in the container - for hot reloading
- /async/node_modules # Exclude node_modules from being overridden
environment:
NODE_ENV: development # Set environment variable
command: ["npm", "run", "dev"]
restart: unless-stopped # Automatic container recovery
healthcheck: # Container health monitoring
test: ["CMD", "curl", "-f", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
Loading