docker-compose prod default
This commit is contained in:
40
docker-compose.dev.yml
Normal file
40
docker-compose.dev.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
# docker-compose.yml for development
|
||||
# This setup runs two services:
|
||||
# 1. The Eleventy dev server for live-reloading site changes.
|
||||
# 2. The Express API server for the view counter.
|
||||
#
|
||||
# To start both, run: docker-compose up
|
||||
#
|
||||
# Your site will be available at http://localhost:8080
|
||||
# Your API will be available at http://localhost:3000
|
||||
services:
|
||||
# This service runs the Eleventy development server.
|
||||
eleventy:
|
||||
build:
|
||||
context: .
|
||||
target: development # Use the 'development' stage from the Dockerfile
|
||||
container_name: eleventy_dev
|
||||
ports:
|
||||
- "8080:8080" # Eleventy dev server port
|
||||
volumes:
|
||||
# Mount the project directory for live-reloading.
|
||||
# The anonymous volume for node_modules prevents the local one from overwriting the container's.
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
# This command runs Eleventy's dev server with file watching.
|
||||
command: npm start
|
||||
|
||||
# This service runs your Express API server.
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
target: development # Use the same 'development' stage
|
||||
container_name: api_dev
|
||||
ports:
|
||||
- "3000:3000" # Express API server port
|
||||
- "9229:9229" # Node.js debugger port
|
||||
volumes:
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
# Use nodemon to automatically restart the server on file changes.
|
||||
command: npx nodemon --inspect=0.0.0.0:9229 src/server.js
|
@@ -1,20 +0,0 @@
|
||||
# docker-compose.prod.yml for production
|
||||
# This setup builds and runs the optimized production image.
|
||||
#
|
||||
# To start, run: docker-compose -f docker-compose.prod.yml up --build
|
||||
#
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
target: production # Use the 'production' stage from the Dockerfile
|
||||
container_name: eleventy_prod
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
# Persist the view count data in a named volume.
|
||||
- views_data:/app/_data
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
views_data:
|
@@ -1,40 +1,20 @@
|
||||
# docker-compose.yml for development
|
||||
# This setup runs two services:
|
||||
# 1. The Eleventy dev server for live-reloading site changes.
|
||||
# 2. The Express API server for the view counter.
|
||||
# docker-compose.prod.yml for production
|
||||
# This setup builds and runs the optimized production image.
|
||||
#
|
||||
# To start both, run: docker-compose up
|
||||
# To start, run: docker-compose -f docker-compose.prod.yml up --build
|
||||
#
|
||||
# Your site will be available at http://localhost:8080
|
||||
# Your API will be available at http://localhost:3000
|
||||
services:
|
||||
# This service runs the Eleventy development server.
|
||||
eleventy:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
target: development # Use the 'development' stage from the Dockerfile
|
||||
container_name: eleventy_dev
|
||||
target: production # Use the 'production' stage from the Dockerfile
|
||||
container_name: eleventy_prod
|
||||
ports:
|
||||
- "8080:8080" # Eleventy dev server port
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
# Mount the project directory for live-reloading.
|
||||
# The anonymous volume for node_modules prevents the local one from overwriting the container's.
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
# This command runs Eleventy's dev server with file watching.
|
||||
command: npm start
|
||||
# Persist the view count data in a named volume.
|
||||
- views_data:/app/_data
|
||||
restart: unless-stopped
|
||||
|
||||
# This service runs your Express API server.
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
target: development # Use the same 'development' stage
|
||||
container_name: api_dev
|
||||
ports:
|
||||
- "3000:3000" # Express API server port
|
||||
- "9229:9229" # Node.js debugger port
|
||||
volumes:
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
# Use nodemon to automatically restart the server on file changes.
|
||||
command: npx nodemon --inspect=0.0.0.0:9229 src/server.js
|
||||
volumes:
|
||||
views_data:
|
||||
|
Reference in New Issue
Block a user