title: NestJs Docker container shows errors
body: <p>I have dockerized a NestJs application. But running it shows</p>
  <p><strong>Error: Error loading shared library /usr/src/app/node_modules/argon2/lib/binding/napi-v3/argon2.node: Exec format error</strong></p>
  <p>and sometimes it shows
  <strong>Cannot find module 'webpack'</strong></p>
  <p>Strangely, it works fine on Windows but the errors come up on mac and amazon linux.</p>
  <p><strong>Dockerfile</strong></p>
  <pre><code>###################
  # BUILD FOR LOCAL DEVELOPMENT
  ###################
  
  FROM node:16-alpine As development
  
  WORKDIR /usr/src/app
  
  COPY package*.json ./
  
  RUN npm ci
  
  COPY . .
  
  ###################
  # BUILD FOR PRODUCTION
  ###################
  
  FROM node:16-alpine As build
  
  WORKDIR /usr/src/app
  
  COPY package*.json ./
  
  COPY --from=development /usr/src/app/node_modules ./node_modules
  
  COPY . .
  
  RUN npm run build
  
  ENV NODE_ENV production
  
  RUN npm ci --only=production &amp;&amp; npm cache clean --force
  
  USER node
  
  ###################
  # PRODUCTION
  ###################
  
  FROM node:16-alpine As production
  
  COPY --from=build /usr/src/app/node_modules ./node_modules
  COPY --from=build /usr/src/app/dist ./dist
  
  CMD [ &quot;node&quot;, &quot;dist/main.js&quot; ]
  
  </code></pre>
  <p><strong>docker-compose.yml</strong></p>
  <pre><code>version: '3.9'
  
  services:
      api:
          build:
              dockerfile: Dockerfile
              context: .
              # Only will build development stage from our dockerfile
              target: development
          env_file:
              - .env
          volumes:
              - api-data:/usr/src/app
          # Run in dev Mode: npm run start:dev
          command: npm run start:dev
          ports:
              - 3000:3000
          depends_on:
              - postgres
          restart: 'always'
          networks:
              - prism-network
      postgres:
          image: postgres:14-alpine
          environment:
              POSTGRES_DB: 'prism'
              POSTGRES_USER: 'postgres'
              POSTGRES_PASSWORD: 'mysecretpassword'
          volumes:
              - postgres-data:/var/lib/postgresql/data
          ports:
              - 5432:5432
          healthcheck:
              test:
                  [
                      'CMD-SHELL',
                      'pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}',
                  ]
              interval: 10s
              timeout: 5s
              retries: 5
          networks:
              - prism-network
  networks:
      prism-network:
  
  volumes:
      api-data:
      postgres-data:
  
  </code></pre>
  <p>I am stumped, why it isn't working.</p>