Created
February 5, 2025 10:59
-
-
Save JannikZed/9fe9182e029879caa244bdfd7269b176 to your computer and use it in GitHub Desktop.
compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Comments are provided throughout this file to help you get started. | |
# If you need more help, visit the Docker compose reference guide at | |
# https://docs.docker.com/compose/compose-file/ | |
# Here the instructions define your application as two services called "todo-app" and “todo-database” | |
# The service “todo-app” is built from the Dockerfile in the /app directory, | |
# and the service “todo-database” uses the official MongoDB image | |
# from Docker Hub - https://hub.docker.com/_/mongo. | |
# You can add other services your application may depend on here. | |
services: | |
traefik: | |
image: traefik:v3.3 | |
command: | |
- --api.insecure=true | |
- --providers.docker | |
- --entrypoints.web.address=:86 | |
ports: | |
- 86:86 | |
- 8080:8080 | |
- 443:443 | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
todo-app: | |
build: | |
context: ./app | |
depends_on: | |
- todo-database | |
environment: | |
NODE_ENV: production | |
labels: | |
- traefik.enable=true | |
- traefik.http.routers.todo-app.rule=PathPrefix(`/todo`) | |
- traefik.http.services.todo-app.loadbalancer.server.port=3000 | |
# middleware to strip the prefix /todo | |
- traefik.http.middlewares.custom-middleware-name-strip.stripPrefix.prefixes=/todo | |
# activate middleware | |
- traefik.http.routers.todo-app.middlewares=custom-middleware-name-strip | |
develop: | |
watch: | |
- path: ./app/package.json | |
action: rebuild | |
- path: ./app | |
target: /usr/src/app | |
action: sync | |
todo-database: | |
image: mongo:6 | |
volumes: | |
- database:/data/db | |
volumes: | |
database: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment