I have a node app which has a file named ".env" which has all my configuration properties. The docker build command is successful but the file is missing from the docker image. I don't have a ".dockerignore" file in my folder.
Also, another app with the same boilerplate works fine and the ".env" file is copied in the docker image. Any ideas?
FROM node:8-alpine
EXPOSE 3000
ARG NODE_ENV ENV NODE_ENV $NODE_ENV
RUN mkdir /app WORKDIR /app ADD package.json yarn.lock /app/ RUN yarn --pure-lockfile ADD . /app
CMD ["yarn", "docker:start"]
I finally got it to work. The problem was my .env file was added to my .gitignore file(which was missing from my other service) and when I removed it worked. Weird!