From 57beea8d7cb5b11811dc3058ffa3985001d4a529 Mon Sep 17 00:00:00 2001 From: giteaadmin Date: Sat, 23 Aug 2025 11:43:19 -0400 Subject: [PATCH] docker-compose prod default --- docker-compose.dev.yml | 40 +++++++++++++++++++++++++++++++++++++ docker-compose.prod.yml | 20 ------------------- docker-compose.yml | 44 +++++++++++------------------------------ 3 files changed, 52 insertions(+), 52 deletions(-) create mode 100644 docker-compose.dev.yml delete mode 100644 docker-compose.prod.yml diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..e3ef89d --- /dev/null +++ b/docker-compose.dev.yml @@ -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 diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml deleted file mode 100644 index 6cbc7c9..0000000 --- a/docker-compose.prod.yml +++ /dev/null @@ -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: diff --git a/docker-compose.yml b/docker-compose.yml index e3ef89d..6cbc7c9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: