nodejsdeveloperskh

npm i socket timeout error, module not found, hang while building image

Mar 7th, 2022 (edited)
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.81 KB | None | 0 0
  1. // dev.docker-compose.yml
  2. version: "3.7"
  3.  
  4. services:
  5.   flyver-backend:
  6.     image: dev-flyver-backend:v1
  7.     build:
  8.       context: .
  9.       dockerfile: dev.Dockerfile
  10.       args:
  11.         POSTGRES_CONNECTION_STRIG: $DATABASE_URL
  12.     ports:
  13.      - "3000:${SERVER_PORT}"
  14.     depends_on:
  15.      - redis
  16.       - postgres
  17.     restart: always
  18.     environment:
  19.      - NODE_ENV=development
  20.     env_file:
  21.      - .env
  22.       - .postgresql.env
  23.  
  24.   redis:
  25.     image: redis:7.0-rc1-alpine3.15
  26.     restart: always
  27.     command: ["redis-server", "--bind", "redis", "--port", "6379"]
  28.  
  29.   postgres:
  30.     image: postgres:13
  31.     restart: always
  32.     volumes:
  33.      - postgres-data:/data/postgres
  34.     env_file:
  35.      - .postgresql.env
  36.     healthcheck:
  37.       test: ["CMD-SHELL", "pg_isready"]
  38.       interval: 10s
  39.       timeout: 5s
  40.       retries: 5
  41.  
  42. volumes:
  43.   postgres-data:
  44.  
  45.  
  46. // dev.Dockerfile
  47. # FROM node:14.19.0-alpine3.15 as build_stage
  48. FROM node:16.14.0-alpine3.15 as build_stage
  49. # FROM node:16.14.0-stretch-slim
  50.  
  51. WORKDIR /app
  52. # COPY . .
  53. COPY package*.json ./
  54. COPY prisma ./prisma/
  55. RUN NODE_ENV=development npm i
  56. # RUN NODE_ENV=development npm ci
  57. # RUN NODE_ENV=development npx yarn install --immutable --immutable-cache --check-cache --frozen-lockfile --inline-builds --peer --json
  58. COPY . .
  59. RUN npx prisma generate
  60. RUN npm run build
  61. RUN npm prune --production
  62.  
  63. # FROM node:14.19.0-alpine3.15 as build_stage
  64. FROM node:16.14.0-alpine3.15
  65. # FROM node:16.14.0-stretch-slim
  66.  
  67. WORKDIR /app
  68. # RUN mkdir /app/pgdata
  69. COPY --from=build_stage /app/node_modules ./node_modules
  70. COPY --from=build_stage /app/package*.json ./
  71. COPY --from=build_stage /app/dist ./dist
  72.  
  73. CMD [ "npm", "run", "start:prod" ]
  74.  
  75. EXPOSE $SERVER_PORT
  76.  
  77.  
  78. // Command I run in the shell:
  79. $ docker-compose -f dev.docker-compose.yml up --build
Add Comment
Please, Sign In to add comment