This template provides two methods to get started with Kottster:
- Option 1: Using Docker Compose (recommended for most users)
- Option 2: Using Docker commands directly
Both the Dockerfile and docker-compose.yml are already included in the repository for your convenience.
git clone https://github.com/kottster/kottster-template-js my-kottster-app
cd my-kottster-appdocker-compose up -dIMPORTANT: The
-dflag is crucial as it runs the container in detached mode (background). Without this flag, your terminal will be locked to the container's output, and you won't be able to run the next command to start the application.
Development mode:
docker exec -it my-kottster-container /dev.shProduction mode:
docker exec -it my-kottster-container /prod.shStop the container:
docker-compose downView container logs:
docker-compose logsgit clone https://github.com/kottster/kottster-template-js my-kottster-app
cd my-kottster-appdocker build -t my-kottster-app .docker run -d --name my-kottster-container \
-p 5480:5480 -p 5481:5481 \
-v $(pwd):/app \
-v /app/node_modules \
my-kottster-appHere's what each flag does:
-d- Run the container in the background--name my-kottster-container- Assign a name to the container-p 5480:5480 -p 5481:5481- Map the container ports to the host machine-v $(pwd):/app- Mount the current directory to the/appdirectory in the container-v /app/node_modules- Mount thenode_modulesdirectory to the container
Development mode:
docker exec -it my-kottster-container /dev.shProduction mode:
docker exec -it my-kottster-container /prod.shStop the container:
docker stop my-kottster-containerRemove the container:
docker rm my-kottster-containerView container logs:
docker logs my-kottster-containerThe container is configured to synchronize your local codebase with the container. Any changes made to your local files will be immediately reflected in the running application.
Edit the ports section in your docker-compose.yml file:
ports:
- "<host-port>:5480"
- "<host-port>:5481"Modify the -p flags in the Docker run command:
docker run -d --name my-kottster-container \
-p <host-port>:5480 -p <host-port>:5481 \
-v $(pwd):/app \
-v /app/node_modules \
my-kottster-app