-
Notifications
You must be signed in to change notification settings - Fork 7
Fix ENV variables are not being set inside docker #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
|
|
||
| # Copy override ENV script with default values | ||
| COPY ./env.sh . | ||
| COPY .env . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the issue could be fixed by just this one line change, to copy .env file to Docker container
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is how it currently works and though the root cause
it's copied with default values like localhos:4200 and when container starts it should be overridden by ENV variables from docker
if the script to form new .env file is not executed within the container it remains unchanged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify what do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what I expect _env_ variable to be on real env
{
PORT: "443"
REACT_APP_API_URL: "https://visual-regression-tracker.com:4200"
VRT_VERSION: "5.0.0-rc3"
}
despite the values that are copied into image initially https://github.com/Visual-Regression-Tracker/frontend/blob/master/.env
we set those values via docker-compose env variables https://github.com/Visual-Regression-Tracker/frontend/blob/master/docker-compose.yml#L13-L14
so when you start the app we have script executed to form new _env_ https://github.com/Visual-Regression-Tracker/frontend/blob/master/package.json#L41
and we need the same inside the container
I could have used initial node script but alpine image doesn't have node installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see. So the JavaScript file generation should happen later in the process, perhaps in the stage 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SwiLink I can see that VRT_VERSION is set
what is the value in .env for REACT_APP_API_URL?
also docker-compose file should have it set as in template https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/blob/master/docker-compose.yml#L18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
REACT_APP_API_URL - https://mywebsite.com/api, for example, but it's really set in .env, have rebuilded images and containers multiple times. Can provide real website personally in Telegram, i think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SwiLink let's keep it transparent
I'm not providing support via private messages, we have public chat and github for it
replace sensitive data before sharing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Ok, here is my .env:
## Logging
# https://www.elastic.co/guide/en/elastic-stack/7.14/overview.html
ELK_VERSION=7.14.1
ELASTIC_URL=http://localhost:9200
## VRT version
VRT_UI_VERSION="5.0.0-rc3"
VRT_API_VERSION=5.0.0
VRT_MIGRATION_VERSION=5.0.0
## Frontend
# direct URL to backend with port (same as APP_PORT)
REACT_APP_API_URL=https://screenshots.wifox.org/api
# frontend port
PORT=8080
## Backend
# direct URL to frontend with port (same as PORT)
APP_FRONTEND_URL=https://screenshots.wifox.org
# backend port
APP_PORT=4200
# seed to generate JWT
JWT_SECRET=test
# user session lifetime
JWT_LIFE_TIME=1d
# max image size to upload
BODY_PARSER_JSON_LIMIT="5mb"
## DB
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=vrt_db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's working:)) Don't know what's the reason, but i know that later it will stop to work:)








closes Visual-Regression-Tracker/Visual-Regression-Tracker#414