-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from devsargam/feat/setup-docker
Feat: setup docker
- Loading branch information
Showing
10 changed files
with
269 additions
and
553 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.git | ||
.gitignore | ||
.env.example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM node:20-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY package.json package-lock.json ./ | ||
COPY prisma ./prisma | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["npm", "run", "dev:docker"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,42 @@ | ||
<h1 align='center'>CMS</h1> | ||
|
||
## Setup procedure | ||
|
||
- Docker | ||
|
||
or | ||
|
||
- Copy .env.example to .env | ||
- Get a postgres db from https://neon.tech/ (or any other provider) | ||
- replace the DATABASE_URL in .env | ||
- Run `npx prisma migrate dev` to setup schema | ||
- cd migrations, Seed SQL data - | ||
|
||
## Setup procedure - | ||
- Copy .env.example to .env | ||
- Get a postgres db from https://neon.tech/ (or any other provider) | ||
- replace the DATABASE_URL in .env | ||
- Run `npx prisma migrate dev` to setup schema | ||
- cd migrations, Seed SQL data - | ||
``` | ||
psql -h your_db_host -d your_db -U your_username < neondb_backup.sql | ||
``` | ||
|
||
For example | ||
|
||
``` | ||
psql -h ep-super-wildflower-a5sqjjhz.us-east-2.aws.neon.tech -d neondb -U harkirat < neondb_backup.sql | ||
``` | ||
- npm install | ||
- npm run dev | ||
- Login using any userid and password 123456 | ||
- You should be able to see some test courses | ||
|
||
Read [contributing guidelines](./CONTRIBUTING.md) to start making contributions | ||
--- | ||
|
||
## Steps to run locally | ||
|
||
#### With Docker | ||
|
||
- docker compose up | ||
|
||
#### Without Docker | ||
|
||
- npm install | ||
- npm run dev | ||
- Login using any userid and password 123456 | ||
- You should be able to see some test courses | ||
|
||
--- | ||
|
||
Read [contributing guidelines](./CONTRIBUTING.md) to start making contributions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
version: '3.5' | ||
services: | ||
app: | ||
build: . | ||
container_name: cms-docker | ||
environment: | ||
- DATABASE_URL=postgresql://postgres:postgres@db:5432/cms?schema=public | ||
ports: | ||
- '3000:3000' | ||
volumes: | ||
- .:/usr/src/app | ||
- /usr/src/app/node_modules | ||
depends_on: | ||
- db | ||
|
||
db: | ||
image: postgres:9.6 | ||
restart: always | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: cms | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- /postgres-data:/var/lib/postgresql/data |
Oops, something went wrong.