From 3978f4c5a0c4b938b6477700b8dfffd6652a0347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9E=E3=83=AB=E3=82=B3=E3=83=A1?= Date: Wed, 30 Oct 2024 07:29:10 +0900 Subject: [PATCH] examples: replace the all `docker-compose.yml` with `compose.yaml` (#71006) # Summary Rename docker compose file to `compose.yaml`. Update docker compose command. ## Description According to [official manuals](https://docs.docker.com/compose/intro/compose-application-model/#the-compose-file), > The default path for a Compose file is `compose.yaml` (preferred) or `compose.yml` that is placed in the working directory. Compose also supports `docker-compose.yaml` and `docker-compose.yml` for backwards compatibility of earlier versions. If both files exist, Compose prefers the canonical `compose.yaml`. ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md x-ref: [The Compose file](https://docs.docker.com/compose/intro/compose-application-model/#the-compose-file) x-ref: [docker-compose vs docker compose](https://docs.docker.com/compose/releases/migrate/#docker-compose-vs-docker-compose) Co-authored-by: JJ Kasper --- examples/cache-handler-redis/README.md | 4 ++-- .../{docker-compose.yml => compose.yaml} | 0 examples/with-docker-compose/README.md | 12 ++++++------ ...docker-compose.dev.yml => compose.dev.yaml} | 2 +- ...ml => compose.prod-without-multistage.yaml} | 0 ...cker-compose.prod.yml => compose.prod.yaml} | 0 examples/with-docker-multi-env/Makefile | 18 +++++++++--------- .../{docker-compose.yml => compose.yaml} | 0 .../{docker-compose.yml => compose.yaml} | 0 .../{docker-compose.yml => compose.yaml} | 0 10 files changed, 18 insertions(+), 18 deletions(-) rename examples/cache-handler-redis/{docker-compose.yml => compose.yaml} (100%) rename examples/with-docker-compose/{docker-compose.dev.yml => compose.dev.yaml} (91%) rename examples/with-docker-compose/{docker-compose.prod-without-multistage.yml => compose.prod-without-multistage.yaml} (100%) rename examples/with-docker-compose/{docker-compose.prod.yml => compose.prod.yaml} (100%) rename examples/with-docker-multi-env/docker/development/{docker-compose.yml => compose.yaml} (100%) rename examples/with-docker-multi-env/docker/production/{docker-compose.yml => compose.yaml} (100%) rename examples/with-docker-multi-env/docker/staging/{docker-compose.yml => compose.yaml} (100%) diff --git a/examples/cache-handler-redis/README.md b/examples/cache-handler-redis/README.md index 40f16504310f03..35b426a9697010 100644 --- a/examples/cache-handler-redis/README.md +++ b/examples/cache-handler-redis/README.md @@ -24,7 +24,7 @@ pnpm create next-app --example cache-handler-redis cache-handler-redis-app Once you have installed the dependencies, you can begin running the example Redis Stack server by using the following command: ```bash -docker-compose up -d +docker compose up -d ``` Then, build and start the Next.js app as usual. @@ -49,7 +49,7 @@ For detailed information on configuration and usage, please refer to our compreh ## Development and Production Considerations -- The provided `docker-compose.yml` is intended for local development. For production deployment, refer to the official [Redis installation](https://redis.io/docs/install/) and [management](https://redis.io/docs/management/) guidelines. +- The provided `compose.yaml` is intended for local development. For production deployment, refer to the official [Redis installation](https://redis.io/docs/install/) and [management](https://redis.io/docs/management/) guidelines. - **Clearing Redis Cache:** To clear the Redis cache, use RedisInsight Workbench or the following CLI command: diff --git a/examples/cache-handler-redis/docker-compose.yml b/examples/cache-handler-redis/compose.yaml similarity index 100% rename from examples/cache-handler-redis/docker-compose.yml rename to examples/cache-handler-redis/compose.yaml diff --git a/examples/with-docker-compose/README.md b/examples/with-docker-compose/README.md index f43adce40a6bae..c8f2c935e0d270 100644 --- a/examples/with-docker-compose/README.md +++ b/examples/with-docker-compose/README.md @@ -46,10 +46,10 @@ First, run the development server: docker network create my_network # Build dev -docker compose -f docker-compose.dev.yml build +docker compose -f compose.dev.yaml build # Up dev -docker compose -f docker-compose.dev.yml up +docker compose -f compose.dev.yaml up ``` Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. @@ -68,10 +68,10 @@ First, run the production server (Final image approximately 110 MB). docker network create my_network # Build prod -docker compose -f docker-compose.prod.yml build +docker compose -f compose.prod.yaml build # Up prod in detached mode -docker compose -f docker-compose.prod.yml up -d +docker compose -f compose.prod.yaml up -d ``` Alternatively, run the production server without multistage builds (Final image approximately 1 GB). @@ -82,10 +82,10 @@ Alternatively, run the production server without multistage builds (Final image docker network create my_network # Build prod without multistage -docker compose -f docker-compose.prod-without-multistage.yml build +docker compose -f compose.prod-without-multistage.yaml build # Up prod without multistage in detached mode -docker compose -f docker-compose.prod-without-multistage.yml up -d +docker compose -f compose.prod-without-multistage.yaml up -d ``` Open [http://localhost:3000](http://localhost:3000). diff --git a/examples/with-docker-compose/docker-compose.dev.yml b/examples/with-docker-compose/compose.dev.yaml similarity index 91% rename from examples/with-docker-compose/docker-compose.dev.yml rename to examples/with-docker-compose/compose.dev.yaml index 448408f832c700..bacbf5498ed77b 100644 --- a/examples/with-docker-compose/docker-compose.dev.yml +++ b/examples/with-docker-compose/compose.dev.yaml @@ -5,7 +5,7 @@ services: context: ./next-app dockerfile: dev.Dockerfile - # Set environment variables directly in the docker-compose file + # Set environment variables directly in the compose file environment: ENV_VARIABLE: ${ENV_VARIABLE} NEXT_PUBLIC_ENV_VARIABLE: ${NEXT_PUBLIC_ENV_VARIABLE} diff --git a/examples/with-docker-compose/docker-compose.prod-without-multistage.yml b/examples/with-docker-compose/compose.prod-without-multistage.yaml similarity index 100% rename from examples/with-docker-compose/docker-compose.prod-without-multistage.yml rename to examples/with-docker-compose/compose.prod-without-multistage.yaml diff --git a/examples/with-docker-compose/docker-compose.prod.yml b/examples/with-docker-compose/compose.prod.yaml similarity index 100% rename from examples/with-docker-compose/docker-compose.prod.yml rename to examples/with-docker-compose/compose.prod.yaml diff --git a/examples/with-docker-multi-env/Makefile b/examples/with-docker-multi-env/Makefile index 759e426b4a7a1c..6f94043638e4a4 100644 --- a/examples/with-docker-multi-env/Makefile +++ b/examples/with-docker-multi-env/Makefile @@ -1,35 +1,35 @@ .PHONY: build-development build-development: ## Build the development docker image. - docker compose -f docker/development/docker-compose.yml build + docker compose -f docker/development/compose.yaml build .PHONY: start-development start-development: ## Start the development docker container. - docker compose -f docker/development/docker-compose.yml up -d + docker compose -f docker/development/compose.yaml up -d .PHONY: stop-development stop-development: ## Stop the development docker container. - docker compose -f docker/development/docker-compose.yml down + docker compose -f docker/development/compose.yaml down .PHONY: build-staging build-staging: ## Build the staging docker image. - docker compose -f docker/staging/docker-compose.yml build + docker compose -f docker/staging/compose.yaml build .PHONY: start-staging start-staging: ## Start the staging docker container. - docker compose -f docker/staging/docker-compose.yml up -d + docker compose -f docker/staging/compose.yaml up -d .PHONY: stop-staging stop-staging: ## Stop the staging docker container. - docker compose -f docker/staging/docker-compose.yml down + docker compose -f docker/staging/compose.yaml down .PHONY: build-production build-production: ## Build the production docker image. - docker compose -f docker/production/docker-compose.yml build + docker compose -f docker/production/compose.yaml build .PHONY: start-production start-production: ## Start the production docker container. - docker compose -f docker/production/docker-compose.yml up -d + docker compose -f docker/production/compose.yaml up -d .PHONY: stop-production stop-production: ## Stop the production docker container. - docker compose -f docker/production/docker-compose.yml down + docker compose -f docker/production/compose.yaml down diff --git a/examples/with-docker-multi-env/docker/development/docker-compose.yml b/examples/with-docker-multi-env/docker/development/compose.yaml similarity index 100% rename from examples/with-docker-multi-env/docker/development/docker-compose.yml rename to examples/with-docker-multi-env/docker/development/compose.yaml diff --git a/examples/with-docker-multi-env/docker/production/docker-compose.yml b/examples/with-docker-multi-env/docker/production/compose.yaml similarity index 100% rename from examples/with-docker-multi-env/docker/production/docker-compose.yml rename to examples/with-docker-multi-env/docker/production/compose.yaml diff --git a/examples/with-docker-multi-env/docker/staging/docker-compose.yml b/examples/with-docker-multi-env/docker/staging/compose.yaml similarity index 100% rename from examples/with-docker-multi-env/docker/staging/docker-compose.yml rename to examples/with-docker-multi-env/docker/staging/compose.yaml