I am trying to setup a Dockerfile so that it has instructions to setup JAVA_HOME environment variable setup in the container when it starts. Then it install my node application. I need the Java environment for the xsd-schema-validator library. The library needs JAVA_HOME environment set in the container. This is what I have:
FROM openjdk:9
ENV JAVA_HOME /usr/lib/jvm
RUN export JAVA_HOME
RUN echo $JAVA_HOME
FROM collinestes/docker-node-oracle:latest
# Create app directory
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
RUN npm run package
# Bundle app source
COPY . ./build
CMD [ "node", "bundle-app.js" ]
The node app seems to start up fine. I dont see any errors when docker container starts. However when I invoke the application it crashes with error javaError: spawn javac ENOENT
I think that is because the container does not have the JAVA_HOME variable set. I have done docker exec -i -t container bash
and tried command echo $JAVA_HOME
and it does not show the java executable. Additionally the java and javac commands do not work.
Does anyone know what I am doing wrong? Any help would be appreciated. Thanks in advance!