1

I am currently using Docker container to run my Backend code. But node modules are not installed even my Docker-file has "RUN yarn" command. This is my Docker-File

FROM node:18-alpine3.18

RUN mkdir -p /usr/node/app/logs
RUN chmod -R 777 /usr/node/app
WORKDIR /usr/node/app
COPY ./package*.json yarn* ./
RUN yarn
COPY . .
RUN yarn postinstall

RUN mkdir -p ./src/plugins/organization/
COPY /src/plugins/organization ./src/plugins/organization/
WORKDIR /usr/node/app/src/plugins/organization
COPY /src/plugins/organization/package*.json yarn* ./
RUN yarn
RUN yarn build
COPY . .
WORKDIR /usr/node/app
ENV NODE_ENV production
EXPOSE 1337
CMD yarn build && yarn start

I used the same Docker-file to run the application a few months before. It worked fine. But now the node modules are not installing properly.

3
  • How are you running the container? Why do you think the modules aren't installing properly? It looks like you're installing two separate applications in this container; do you have the same problem building just one of them? Commented Mar 25 at 10:13
  • 1. sudo docker build . -t testapp 2. sudo docker run --log-driver local --restart unless-stopped --log-opt max-size=10m --name smartlockdev --env-file .env -p 1337:1337 -d testapp -> These are the commands that i use to run my container. Previously when i build the application the node modules are created at my application folder ie. ./ and ./src/plugins/organization. But now the node modules are not created due to which my application is not running Commented Apr 9 at 10:16
  • Please edit your question to include these details. Commented Apr 9 at 11:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.