I have the following problem:
I want to define an environment variable into my docker-compose.yml file as follow:
services:
nginx:
image: nginx:1.13
container_name: nginx
restart: always
ports:
- "80:80"
- "9090:9090"
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/html:/usr/share/nginx/html
webapp:
build: WebApp
container_name: webapp
environment:
- WEBAPPDB=jdbc:mysql://192.168.101.129:3306/webapp?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8
expose:
- "8080"
depends_on:
- nginx
version: '2'
the webapp application is deployed using tomcat. I would like to use the variable WEBAPPDB into the context.xml file in the following way:
<Resource
auth="Container"
driverClassName="com.mysql.jdbc.Driver"
type="javax.sql.DataSource"
initialSize="0"
maxActive="10"
maxIdle="5"
maxWait="5000"
minIdle="0"
timeBetweenEvictionRunsMillis="34000"
minEvictableIdleTimeMillis="55000"
testOnBorrow="true"
testWhileIdle="true"
testOnReturn="false"
validationQuery="SELECT 1 FROM dual"
validationInterval="30000"
removeAbandoned="true"
removeAbandonedTimeout="10"
name="jdbc/webapp"
username="username"
password="password"
url="${WEBAPPDB}"
/>
How can I do this? thanks for you help.