diff --git a/apps/backend/.dockerignore b/apps/backend/.dockerignore index 1d7d55fa..b2ae7958 100644 --- a/apps/backend/.dockerignore +++ b/apps/backend/.dockerignore @@ -1,5 +1,8 @@ -Dockerfile -.dockerignore node_modules +dist npm-debug.log -dist \ No newline at end of file +CONTRIBUTE.MD +README.md +.gitignore +LICENSE +.DS_Store diff --git a/apps/backend/Dockerfile b/apps/backend/Dockerfile index a6639152..4982af50 100644 --- a/apps/backend/Dockerfile +++ b/apps/backend/Dockerfile @@ -2,9 +2,9 @@ # Dependencies Stage # -------------------------------------------- FROM node:19.2-alpine3.15 as dependencies - WORKDIR /app -COPY package.json package-lock.json ./ + +COPY package*.json ./ RUN apk add --update python3 make g++\ && rm -rf /var/cache/apk/* @@ -32,12 +32,17 @@ FROM node:19.2-alpine3.15 as production WORKDIR /app COPY --from=build /app/dist/apps/backend ./backend -COPY --from=build /app/dist/libs/prisma ./prisma COPY --from=build /app/node_modules ./node_modules -COPY ./libs/ ./libs/ -COPY ./nx.json ./nx.json +COPY --from=build /app/libs/ ./libs EXPOSE 3000 # Start the application CMD sh -c "npx nx migrate-deploy prisma && node backend/main.js" + + + + + + + diff --git a/apps/frontend/Dockerfile b/apps/frontend/Dockerfile index 36f00bdf..04499911 100644 --- a/apps/frontend/Dockerfile +++ b/apps/frontend/Dockerfile @@ -2,16 +2,15 @@ # Dependencies Stage # -------------------------------------------- FROM node:19.2-alpine3.15 as dependencies - WORKDIR /app -COPY package.json package-lock.json ./ + +COPY package*.json ./ RUN apk add --update python3 make g++\ && rm -rf /var/cache/apk/* RUN npm ci - # -------------------------------------------- # Build Stage # -------------------------------------------- @@ -31,7 +30,6 @@ COPY --from=dependencies /app/node_modules ./node_modules # Run prisma generate & build the bundle in production mode RUN npx nx build frontend --prod --skip-nx-cache - # -------------------------------------------- # Production Stage # -------------------------------------------- diff --git a/docker/local/docker-compose.yml b/docker/local/docker-compose.yml index 0b5b1813..b8fa21ba 100644 --- a/docker/local/docker-compose.yml +++ b/docker/local/docker-compose.yml @@ -48,8 +48,6 @@ services: restart: always ports: - '3000:3000' - volumes: - - ../../:/app/ env_file: ../../.env depends_on: - postgres diff --git a/libs/config/src/lib/config.module.ts b/libs/config/src/lib/config.module.ts index cbff4f7f..b7a33b58 100644 --- a/libs/config/src/lib/config.module.ts +++ b/libs/config/src/lib/config.module.ts @@ -8,7 +8,6 @@ import { AppConfigService } from './config.service'; imports: [ ConfigModule.forRoot({ isGlobal: true, - envFilePath: ['../../.env'], load: [configFactory], cache: true, }), diff --git a/libs/prisma/project.json b/libs/prisma/project.json index 20a24888..794d63c5 100644 --- a/libs/prisma/project.json +++ b/libs/prisma/project.json @@ -13,18 +13,14 @@ "migrate-dev": { "executor": "nx:run-commands", "options": { - "command": "npx prisma migrate dev --schema=src/schema.prisma --name={args.name}", - "cwd": "libs/prisma", - "envFile": "../../.env", + "command": "npx prisma migrate dev --schema=libs/prisma/src/schema.prisma --name={args.name}", "parallel": true } }, "migrate-deploy": { "executor": "nx:run-commands", "options": { - "command": "npx prisma migrate deploy --schema=src/schema.prisma", - "cwd": "libs/prisma", - "envFile": "../../.env", + "command": "npx prisma migrate deploy --schema=libs/prisma/src/schema.prisma", "parallel": true } },