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
|
# docker-compose.prod.yml for production
|
||||||
# This setup runs two services:
|
# This setup builds and runs the optimized production image.
|
||||||
# 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
|
# 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:
|
services:
|
||||||
# This service runs the Eleventy development server.
|
app:
|
||||||
eleventy:
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
target: development # Use the 'development' stage from the Dockerfile
|
target: production # Use the 'production' stage from the Dockerfile
|
||||||
container_name: eleventy_dev
|
container_name: eleventy_prod
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080" # Eleventy dev server port
|
- "3000:3000"
|
||||||
volumes:
|
volumes:
|
||||||
# Mount the project directory for live-reloading.
|
# Persist the view count data in a named volume.
|
||||||
# The anonymous volume for node_modules prevents the local one from overwriting the container's.
|
- views_data:/app/_data
|
||||||
- .:/app
|
restart: unless-stopped
|
||||||
- /app/node_modules
|
|
||||||
# This command runs Eleventy's dev server with file watching.
|
|
||||||
command: npm start
|
|
||||||
|
|
||||||
# This service runs your Express API server.
|
volumes:
|
||||||
api:
|
views_data:
|
||||||
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
|
|
||||||
|
Reference in New Issue
Block a user