Skip to content

Commit

Permalink
Merge pull request #1127 from ShobhitPatra/feat/dockerization_done
Browse files Browse the repository at this point in the history
Added DockerFile and Docker-compose
  • Loading branch information
mdazfar2 authored Nov 23, 2024
2 parents ca0418e + 347bafe commit cfcd6f6
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
Empty file added .dockerignore
Empty file.
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build on PR

on:
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install Dependencies
run: npm install

- name: Run Build
run: npm run build
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:20-alpine as Base
WORKDIR /usr/src/ezyshop
COPY *.json *.mjs *.js ./
COPY prisma ./prisma
RUN npm install
RUN npx prisma generate

FROM base AS development
COPY . .

EXPOSE 3000
CMD ["npm", "run", "dev"]



24 changes: 24 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'
services:
mongodb:
image: mongo
container_name: mongodb
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db

ezyshop:
build:
context: .
dockerfile: Dockerfile
container_name: ezyshop
depends_on:
- mongodb
ports:
- "3000:3000"
environment:
- DATABASE_URL=mongodb://mongodb:27017/

volumes:
mongodb_data:

0 comments on commit cfcd6f6

Please sign in to comment.