Last active
April 30, 2022 20:52
-
-
Save FerusAndBeyond/ac46a88d9c394c2ed92d44e8f2ce3018 to your computer and use it in GitHub Desktop.
env-variable part 5
This file contains 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
version: '3' | |
services: | |
my_component: | |
# Here you can specify an env-file with variables | |
# that can be used in the docker-container, | |
# BUT these variables can not be used here in the | |
# docker-compose using ${...} UNLESS it is a file named | |
# ".env". This file (in the same directory) is always | |
# loaded into the docker-compose, but not into the | |
# docker-containers unless the variables are mapped in the | |
# environment option below or using the env_file option here. | |
env_file: .env | |
container_name: my_component | |
build: | |
context: . | |
dockerfile: Dockerfile | |
environment: # specify the env-variables here | |
# secret ones in .env file or system | |
MY_SECRET_VARIABLE: ${MY_SECRET_VARIABLE} | |
# and public ones can be hardcoded | |
MY_PUBLIC_VARIABLE: Hello world | |
# sometimes the console won't show print messages, | |
# using PYTHONUNBUFFERED: 1 can fix this | |
PYTHONUNBUFFERED: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment