R
Railway15mo ago
cern7

Build Failed

Project ID: {0609d9e9-c979-4a60-abc4-c954d2f050e5} Trying to build my spring project with "mvn install" and I get : java.lang.IllegalArgumentException: Could not resolve placeholder 'jwt.secret' in value "${jwt.secret}" I did add the variable in service Variables as jwt.secret and the value.
No description
No description
No description
Solution:
if you need environment variables to be available during a dockerfile build you need to bring them in with ARG <variable name>
Jump to solution
14 Replies
Percy
Percy15mo ago
Project ID: 0609d9e9-c979-4a60-abc4-c954d2f050e5
Brody
Brody15mo ago
@aleks have any ideas?
cern7
cern7OP15mo ago
it worked before, tried to remove/add back the variable, doesn't help
Brody
Brody15mo ago
before what?
cern7
cern7OP15mo ago
few commits back all the changes I add, have nothing with this JWToken instance
Brody
Brody15mo ago
redeploy an old deployment from within your service
cern7
cern7OP15mo ago
the diff is that it skipped Tests, I updated Dockerfile to mvn install and got this error for jwt.token
No description
cern7
cern7OP15mo ago
the q is why it doesn't see the variable in Variables
Brody
Brody15mo ago
have you referenced the variables with ARG in your dockerfile?
cern7
cern7OP15mo ago
no
No description
Solution
Brody
Brody15mo ago
if you need environment variables to be available during a dockerfile build you need to bring them in with ARG <variable name>
cern7
cern7OP15mo ago
Build stage FROM maven:3.6.3-openjdk-17 AS build COPY application/src /home/app/src COPY application/pom.xml /home/app ARG jwt_secret ENV jwt.secret=$jwt_secret WORKDIR /home/app RUN mvn install will it work ?
Brody
Brody15mo ago
probably not considering that's not the variable name you use in the service variables
cern7
cern7OP15mo ago
this helped
No description
Want results from more Discord servers?
Add your server