Skip to content

Commit

Permalink
rewrite dockerfile to place node_modules one directory above volume dir
Browse files Browse the repository at this point in the history
  • Loading branch information
tmthecoder committed Oct 24, 2023
1 parent 8c6c25f commit 39ac11e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 13 deletions.
14 changes: 10 additions & 4 deletions packages/api-gateway/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
FROM node:18 as deps
FROM node:18-alpine as deps

WORKDIR /app

COPY package.json yarn.lock
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*

RUN yarn install --frozen-lockfile
COPY package.json ./

RUN yarn install

FROM node:18 as dev

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules/

ENV PATH=/app/node_modules/.bin:$PATH

WORKDIR /app/src

COPY . .

EXPOSE 3000
EXPOSE 3000
12 changes: 9 additions & 3 deletions packages/auth-service/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
FROM node:18 as deps
FROM node:18-alpine as deps

WORKDIR /app

COPY package.json yarn.lock
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*

RUN yarn install --frozen-lockfile
COPY package.json ./

RUN yarn install

FROM node:18 as dev

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules/

ENV PATH=/app/node_modules/.bin:$PATH

WORKDIR /app/src

COPY . .

EXPOSE 50052
1 change: 1 addition & 0 deletions packages/db-service/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
**/node_modules
!prisma/
22 changes: 19 additions & 3 deletions packages/db-service/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
FROM node:18 as deps
FROM node:18-alpine as deps

WORKDIR /app

COPY package.json yarn.lock
RUN apk add --update python3 make g++ && rm -rf /var/cache/apk/*

RUN yarn install --frozen-lockfile
RUN yarn global add node-gyp prisma

COPY package.json ./

RUN mkdir prisma

RUN yarn install

FROM node:18 as dev

RUN yarn global add nest prisma

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules/

ENV PATH=/app/node_modules/.bin:$PATH

COPY ./prisma/ ./prisma/

RUN prisma generate

WORKDIR /app/src

COPY . .

EXPOSE 50053
4 changes: 1 addition & 3 deletions packages/db-service/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

yarn prisma migrate deploy

yarn prisma generate
prisma migrate dev

yarn start:dev

0 comments on commit 39ac11e

Please sign in to comment.