Comments (4)
Hello @fleonardelli!
You can say to Docker Compose to use non-default .env-file by setting --env-file
option or by using the env_file
attribute in (one of) compose.yaml file (see https://docs.docker.com/compose/environment-variables/set-environment-variables/).
from symfony-docker.
Can you provide a reproducer pls ?
from symfony-docker.
Run: git clone https://github.com/dunglas/symfony-docker.git .
Modify the compose.prod.yaml to:
# Production environment override
services:
php:
env_file:
- .env.prod.local
build:
context: .
target: frankenphp_prod
environment:
APP_SECRET: ${APP_SECRET}
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
Add .env.prod.local:
SERVER_NAME=:80
APP_SECRET=ChangeMe
CADDY_MERCURE_JWT_SECRET=ChangeThisMercureHubJWTSecretKey
Now run: docker compose -f compose.yaml -f compose.prod.yaml up -d --wait
It will output:
WARN[0000] The "APP_SECRET" variable is not set. Defaulting to a blank string.
WARN[0000] The "CADDY_MERCURE_JWT_SECRET" variable is not set. Defaulting to a blank string.
WARN[0000] The "CADDY_MERCURE_JWT_SECRET" variable is not set. Defaulting to a blank string.
[+] Running 0/1
@maxhelias I guess it's enough. Because of that if I request the server it will always print phpinfo() output.
from symfony-docker.
@fleonardelli when you configure both env_file
attribute and set the values of environment variables to be mandatory, Docker Compose will still warn about missing values for environment variables from the host, even if these values are already set in the env_file
attribute file.
If there are required parameters in environment
attribute, they will not be subtracted from the env_file
attribute file. The values of environment variables are passed through to the container.
If you want to be able to convert environment variables (as is done in this template), then you must use the --env-file
parameter or the COMPOSE_ENV_FILES
environment variable when running the docker compose
command.
The documentation page has a table of results when there are multiple sources for environment variable values. However, there is no example of what the result will be if both parameters are present (in attribute env_file
and in attribute environment
).
from symfony-docker.
Related Issues (20)
- invalid interpolation format for services.php.environment.TRUSTED_HOSTS HOT 1
- Too stupid for recipes HOT 4
- Is mecure required for production? HOT 1
- Unable to connect to external database HOT 1
- Could this repo be converted to a symfony recipe? HOT 1
- Unable to boot app in production mode HOT 2
- Large number of entities cause ORM mapping to break HOT 9
- Unable to deploy in production HOT 3
- invalid interpolation format for services.php.environment.TRUSTED_HOSTS HOT 1
- Informations about my github ci file HOT 1
- Serving Symfony Welcome Page with Docker Compose Opens phpinfo() Instead HOT 2
- Cannot install some PHP extention HOT 1
- Docker escape error HOT 1
- container no run
- Mariadb Connexion lost HOT 5
- Symfony hanging every now & then HOT 17
- Unable to start existing project
- Franken crash HOT 7
- Issue when creating the test database HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symfony-docker.