Can’t rich the .env files
The docker-compose.yml
version: '19.03.0'
services:
alva-back-mobile-strapi4:
image: node:14.19.1-alpine
env_file: alva-back-mobile-strapi4/.env
volumes:
- strapi4-data:/var/home/app/data
- ./alva-back-mobile-strapi4:/alva-back-mobile-strapi4
working_dir: /alva-back-mobile-strapi4
command: sh -c "npm install && npm run build && npm run develop"
ports:
- ${PORT}:${PORT}
my-pets-back:
image: node:16.3.0-alpine
env_files: MyPetsBack/.env
volumes:
- mobile-data:/var/home/app/data
- ./MyPetsBack:/MyPetsBack
working_dir: ./MyPetsBack
command: sh -c "npm install && npm run build && npm run develop"
ports:
- ${PORT}:${PORT}
my-pets-front:
image: node:16.3.0-alpine
env_file: MyPetsFront/.env
volumes:
- front-data:/var/home/app/petData
- ./MyPetsFront:/MyPetsFront
working_dir: /MyPetsFront
command: sh -c "npm install && npm run build && npm run develop"
ports:
- ${PORT}:${PORT}
redis:
image: redis:latest
volumes:
strapi4-data:
mobile-data:
front-data:
The structure of folders (.env is inside folders)
The result
time="2023-03-28T22:44:12+03:00" level=warning msg="The \"PORT\" variable is not set. Defaulting to a blank string."
time="2023-03-28T22:44:12+03:00" level=warning msg="The \"PORT\" variable is not set. Defaulting to a blank string."
time="2023-03-28T22:44:12+03:00" level=warning msg="The \"PORT\" variable is not set. Defaulting to a blank string."
time="2023-03-28T22:44:12+03:00" level=warning msg="The \"PORT\" variable is not set. Defaulting to a blank string."
time="2023-03-28T22:44:12+03:00" level=warning msg="The \"PORT\" variable is not set. Defaulting to a blank string."
time="2023-03-28T22:44:12+03:00" level=warning msg="The \"PORT\" variable is not set. Defaulting to a blank string."
services.my-pets-back Additional property env_files is not allowed
I tried to specify an env_file’s path with . ./nameOfProject/.env /nameOfProject/.env nameOfProject/.env but it doesn’t work. I expect that it’ll work.