Skip to content

Commit

Permalink
Updated - Docker
Browse files Browse the repository at this point in the history
- fix build issue in Dockerfile with prisma generate
- update docker-compose-yml for run app as a docker image
  • Loading branch information
pdovhomilja committed Nov 3, 2023
1 parent 4724a1c commit 8177a65
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 42 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ FROM node:20.9.0-alpine AS deps

WORKDIR /app
COPY package*.json ./
RUN npm install
RUN npm install
# Copy .env and .env.local before the build stage
COPY .env .env.local ./

FROM node:20.9.0-alpine AS BUILD_IMAGE

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
RUN npx prisma generate && npx prisma db push && npm run build

RUN rm -rf node_modules
RUN npm install
RUN npm install

FROM node:20.9.0-alpine

Expand All @@ -28,9 +30,6 @@ COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/node_modules ./node_modules
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/public ./public
COPY --from=BUILD_IMAGE --chown=nextjs:nodejs /app/.next ./.next

# Copy .env and .env.local to the final image
COPY --from=deps --chown=nextjs:nodejs /app/.env ./.env
COPY --from=deps --chown=nextjs:nodejs /app/.env.local ./.env.local

USER nextjs

Expand Down
File renamed without changes.
43 changes: 7 additions & 36 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
version: "3.9"

version: "3"
services:
# MongoDB
mongo_db:
container_name: mongo_db
image: mongo:latest
my-nextjs-app:
image: nextcrmio/nextcrm:0.0.3-beta
container_name: nexcrm
ports:
- 27017:27017
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: root
- "3001:3000"
volumes:
- mongo_data:/data/db

# MongoDB Express
mongo_express:
container_name: mongo_express
image: mongo-express:latest
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: root
ME_CONFIG_MONGODB_SERVER: mongo_db
depends_on:
- mongo_db

nextcrm-app:
build: .
ports:
- "3000:3000"
depends_on:
- mongo_db

volumes:
mongo_data: {}
- .env:/app/.env
- .env.local:/app/.env.local

6 comments on commit 8177a65

@vercel
Copy link

@vercel vercel bot commented on 8177a65 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextcrm-test – ./

nextcrm-test-git-main-e-osvc.vercel.app
nextcrm-test-e-osvc.vercel.app
test.nextcrm.io

@vercel
Copy link

@vercel vercel bot commented on 8177a65 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextcrm-demo – ./

nextcrm-demo-git-main-e-osvc.vercel.app
demo.nextcrm.io
nextcrm-demo-e-osvc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 8177a65 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 8177a65 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 8177a65 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextcrm-others – ./

nextcrm-others-e-osvc.vercel.app
others.nextcrm.io
nextcrm-others-git-main-e-osvc.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 8177a65 Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.