Skip to content
Snippets Groups Projects
Commit 614e56ca authored by D4rkHeart's avatar D4rkHeart
Browse files

[Feat] Docker-compose-dev configuration

- Add Traefik service and configured routing for /gest, /form, and /api endpoints
- Add environment variables
- Deletion of explicit container names so that it is autogenerated
parent a82429ce
No related branches found
No related tags found
1 merge request!6[Feat] Docker configuration
version: '3'
services:
networks:
canap_network:
external: true
services:
# The DB of the application
db:
image: mysql:5.7
container_name: canap_db
environment:
MYSQL_ROOT_PASSWORD: canap_db
MYSQL_DATABASE: canap_db
MYSQL_USER: canap_db
MYSQL_PASSWORD: canap_db
#command: mysqld --general-log=1 --general-log-file=/var/log/mysql/general-log.log
volumes:
- ../data/DB/init-sql:/docker-entrypoint-initdb.d
- ../data/DB/canap_db:/var/lib/mysql
ports:
- "9906:3306"
- "127.0.0.1:9906:3306"
expose:
- 9906
labels:
- "traefik.enable=false"
networks:
- canap_network
# The form for the applicants
form:
build:
context: ./
dockerfile: Dockerfile-form.dockerfile
container_name: canap_form
depends_on:
- db
volumes:
- ../Formulaire:/var/www/html/
- ../data/candidatures:/var/www/html/data/candidatures/
ports:
- "8180:80"
environment:
ENVIRONMENT: docker
FILESERVERPATH: '/var/www/html/data/candidatures/'
SENDEMAILS: true
MAIL_FROM: 'noreply+formulaireApprentis@epfl.ch'
MAIL_CONTACT: 'leonardo.surdez@epfl.ch'
MAIL_REPLYTO: 'leonardo.surdez@epfl.ch'
DB_CONNECTION: mysql
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: canap_db
DB_USERNAME: canap_db
DB_PASSWORD: canap_db
labels:
- traefik.enable=true
- traefik.http.routers.form.rule=Host(`localhost`)
- traefik.http.routers.form.tls=true
- traefik.http.services.form.loadbalancer.server.port=80
networks:
- canap_network
# The API for the management app
api:
build:
context: ./
dockerfile: Dockerfile-api.dockerfile
container_name: canap_api
volumes:
- ../API:/var/www/html/
ports:
- "8181:80"
environment:
DB_CONNECTION: mysql
DB_HOST: db # todo
DB_PORT: 3306 # todo
DB_DATABASE: canap_db # todo
DB_USERNAME: canap_db # todo
DB_PASSWORD: canap_db # todo
TEQUILA_RETURN_URL: 'https://localhost/gest/#/?key='
labels:
- traefik.enable=true
- traefik.http.routers.api.rule=Host(`localhost`) && PathPrefix(`/api`)
- traefik.http.routers.api.tls=true
- traefik.http.services.api.loadbalancer.server.port=80
networks:
- canap_network
# The management app
gest:
image: node:15-alpine
container_name: canap_gest
user: node
working_dir: /home/node/app
depends_on:
- api
environment:
- NODE_ENV=development #production
API_LOCATION: "https://localhost/api"
LOGIN_REDIRECT: "https://localhost/api/auth/login"
NODE_ENV: dev
volumes:
- ../Gestion:/home/node/app
ports:
- "8080:8080"
- ../Formulaire/data/candidatures:/var/www/html/data/candidatures/
entrypoint: /bin/sh
labels:
- traefik.enable=true
- traefik.http.routers.gest.rule=Host(`localhost`) && PathPrefix(`/gest`)
- traefik.http.routers.gest.tls=true
- traefik.http.services.gest.loadbalancer.server.port=8080
command:
- "-c"
- npm i && npm run serve-docker
# networks:
# default:
# external:
# name: canap_network
- env DEBUG=express:router npm run serve-docker
networks:
- canap_network
traefik:
image: traefik:latest
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes: #monter le socket docker
- /var/run/docker.sock:/var/run/docker.sock
command:
- --api.insecure=true # active l'interface API de Traefik sans authentification
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --accesslog=true
- --log.level=DEBUG
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
networks:
- canap_network
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment