Files
vercel__next.js/examples/with-docker-compose/compose.dev.yaml
マルコメ 8f0d5834fe 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 <jj@jjsweb.site>
2024-10-29 15:29:10 -07:00

32 lines
765 B
YAML

services:
next-app:
container_name: next-app
build:
context: ./next-app
dockerfile: dev.Dockerfile
# Set environment variables directly in the compose file
environment:
ENV_VARIABLE: ${ENV_VARIABLE}
NEXT_PUBLIC_ENV_VARIABLE: ${NEXT_PUBLIC_ENV_VARIABLE}
# Set environment variables based on the .env file
env_file:
- .env
volumes:
- ./next-app/src:/app/src
- ./next-app/public:/app/public
restart: always
ports:
- 3000:3000
networks:
- my_network
# Add more containers below (nginx, postgres, etc.)
# Define a network, which allows containers to communicate
# with each other, by using their container name as a hostname
networks:
my_network:
external: true