Hi. Please write docker-compose.yml for Astro and Strapi in one monorepo.
- User
Hi. Please write docker-compose.yml for Astro and Strapi in one monorepo.
- Assistant
Sure! Here's an example of a
docker-compose.ymlfile for running Astro and Strapi in the same monorepo:version: '3.7' services: astro: build: context: ./astro dockerfile: Dockerfile ports: - 3000:3000 volumes: - ./astro:/app strapi: build: context: ./strapi dockerfile: Dockerfile ports: - 1337:1337 volumes: - ./strapi:/app volumes: astro: strapi:In this example, we have two services:
astroandstrapi. Both services are built using their respectiveDockerfilein their respective directories (./astroand./strapi).The
astroservice is mapped to port3000on the host, which is the default port for Astro. The code for Astro is mounted as a volume, so any changes made to the code will be immediately reflected in the running container.Similarly, the
strapiservice is mapped to port1337on the host, which is the default port for Strapi. The code for Strapi is also mounted as a volume for live-reloading.