Skip to content

Commit

Permalink
examples: replace the all docker-compose.yml with compose.yaml (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
2 people authored and kdy1 committed Oct 30, 2024
1 parent ccdffe4 commit 3978f4c
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions examples/cache-handler-redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:

Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions examples/with-docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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).
Expand All @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
18 changes: 9 additions & 9 deletions examples/with-docker-multi-env/Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3978f4c

Please sign in to comment.