-
Notifications
You must be signed in to change notification settings - Fork 268
-
Trying to add a custom environment variable in the Frontend that renders the build date REACT_APP_DATE
(example).
I am using DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcoder-ce .
to build.
I tried everything I could think of.
- created .env file in client/packages/lowcoder/.env
- added
"build": "REACT_APP_DATE=2023年07月10日 vite build && cp ../../VERSION ./build/VERSION"
to client/packages/lowcoder/package.json - Also Add REACT_APP_DATE to docker-compose.yaml and docker-compose-multi.yaml
- or
ARG REACT_APP_DATE="2023-07-10"
before build in Dockerfile
After build I still get undefined when trying to read it process.env.REACT_APP_DATE
.
What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
The disappointing answer is, that this is in general not possible this way.
Reason is, that Lowcoder Frontend is an app, that get's packed (build) before we dockerize it.
As such, only if you would change the source code and then build your own docker, you could make use of an ENV - but also only static. Unfortunately ENVs are not the way to inject dynamic values in the Frontend.
Beta Was this translation helpful? Give feedback.