Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit e00c4a6

Browse files
authored
Merge pull request #499 from sharafdin/feature/support-docker
Docker support for all templates
2 parents 3c207c6 + ade777a commit e00c4a6

File tree

79 files changed

+1053
-55
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1053
-55
lines changed

packages/yonode-templates/JS-MongoDB-Mongoose-Auth-Template/.env

+3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ SERVER_PORT=
88
# Database Configuration
99
# ----------------------
1010
# Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable.
11+
# For example, 'mongodb://root:example@localhost:27017/'.
12+
# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/' where 'db' is the name of the database service.
1113
DATABASE_URL=
1214

15+
1316
# Specify the name of the database to which the application will connect.
1417
# If not specified, the default database 'yonodeDB' will be used.
1518
# Default: yonodeDB
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:21
2+
3+
EXPOSE 8000
4+
5+
WORKDIR /app
6+
7+
COPY . .
8+
9+
RUN npm install -g pnpm
10+
11+
RUN npm install -g nodemon
12+
13+
RUN pnpm install
14+
15+
CMD ["nodemon", "-L", "./src/app.js"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3.9'
2+
3+
services:
4+
db:
5+
image: mongo:latest
6+
container_name: mongo-db
7+
ports:
8+
- '27017:27017'
9+
restart: on-failure
10+
# healthcheck:
11+
# test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
12+
# interval: 10s
13+
# timeout: 5s
14+
# retries: 5
15+
16+
17+
server:
18+
build: .
19+
container_name: yonode-server
20+
restart: on-failure
21+
volumes:
22+
- .:/app
23+
- /app/node_modules
24+
ports:
25+
- '8000:8000'
26+
environment:
27+
DATABASE_URL: ${DATABASE_URL}
28+
SERVER_PORT: ${SERVER_PORT}
29+
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
30+
NODE_ENVIRONMENT: ${NODE_ENVIRONMENT}
31+
depends_on:
32+
- db
33+

packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/.env

+3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ SERVER_PORT=
88
# Database Configuration
99
# ----------------------
1010
# Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable.
11+
# For example, 'mongodb://root:example@localhost:27017/'.
12+
# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/' where 'db' is the name of the database service.
1113
DATABASE_URL=
1214

15+
1316
# Specify the name of the database to which the application will connect.
1417
# If not specified, the default database 'yonodeDB' will be used.
1518
# Default: yonodeDB
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:21
2+
3+
EXPOSE 8000
4+
5+
WORKDIR /app
6+
7+
COPY . .
8+
9+
RUN npm install -g pnpm
10+
11+
RUN npm install -g nodemon
12+
13+
RUN pnpm install
14+
15+
CMD ["nodemon", "-L", "./src/app.js"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: '3.9'
2+
3+
services:
4+
db:
5+
image: mongo:latest
6+
container_name: mongo-db
7+
ports:
8+
- '27017:27017'
9+
environment:
10+
MONGO_INITDB_ROOT_USERNAME: root
11+
MONGO_INITDB_ROOT_PASSWORD: toor
12+
restart: on-failure
13+
# healthcheck:
14+
# test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
15+
# interval: 10s
16+
# timeout: 5s
17+
# retries: 5
18+
19+
20+
server:
21+
build: .
22+
container_name: yonode-server
23+
restart: on-failure
24+
volumes:
25+
- .:/app
26+
- /app/node_modules
27+
ports:
28+
- '8000:8000'
29+
environment:
30+
DATABASE_URL: ${DATABASE_URL}
31+
SERVER_PORT: ${SERVER_PORT}
32+
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
33+
NODE_ENVIRONMENT: ${NODE_ENVIRONMENT}
34+
depends_on:
35+
- db
36+

packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/.env

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ SERVER_PORT=
88
# Database Configuration
99
# ----------------------
1010
# Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable.
11+
# For example, 'mongodb://root:example@localhost:27017/yonodeDB'.
12+
# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/yonodeDB' where 'db' is the name of the database service.
1113
DATABASE_URL=
1214

1315
# Authentication and Security Configuration
@@ -22,4 +24,4 @@ JWT_SECRET_KEY=
2224
# This setting can influence the application's behavior, enabling or disabling certain features based on the environment.
2325
# For example, in 'development' mode, more verbose logging might be enabled, whereas 'production' might focus on performance optimizations and error handling.
2426
# Default: development (if not specified)
25-
NODE_ENVIRONMENT=
27+
NODE_ENVIRONMENT=
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:21
2+
3+
EXPOSE 8000
4+
5+
WORKDIR /app
6+
7+
COPY . .
8+
9+
RUN npm install -g pnpm
10+
11+
RUN npm install -g nodemon
12+
13+
RUN pnpm install
14+
15+
RUN npx prisma generate
16+
17+
CMD ["nodemon", "-L", "./src/app.js"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: '3.9'
2+
3+
services:
4+
db:
5+
image: mongo:latest
6+
container_name: mongo-db
7+
ports:
8+
- '27017:27017'
9+
environment:
10+
MONGO_INITDB_ROOT_USERNAME: root
11+
MONGO_INITDB_ROOT_PASSWORD: toor
12+
restart: on-failure
13+
# healthcheck:
14+
# test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
15+
# interval: 10s
16+
# timeout: 5s
17+
# retries: 5
18+
19+
20+
server:
21+
build: .
22+
container_name: yonode-server
23+
restart: on-failure
24+
volumes:
25+
- .:/app
26+
- /app/node_modules
27+
ports:
28+
- '8000:8000'
29+
environment:
30+
DATABASE_URL: ${DATABASE_URL}
31+
SERVER_PORT: ${SERVER_PORT}
32+
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
33+
NODE_ENVIRONMENT: ${NODE_ENVIRONMENT}
34+
depends_on:
35+
- db
36+

packages/yonode-templates/JS-MongoDB-Prisma-Auth-Template/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
"helmet": "^7.1.0",
2323
"jsonwebtoken": "^9.0.2",
2424
"mongoose": "^8.3.4",
25-
"morgan": "^1.10.0"
25+
"morgan": "^1.10.0",
26+
"prisma": "^5.13.0"
2627
},
2728
"devDependencies": {
2829
"nodemon": "^3.1.0",
29-
"yonode": "^1.2.3",
30-
"prisma": "^5.13.0"
30+
"yonode": "^1.2.3"
3131
}
3232
}

packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/.env

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ SERVER_PORT=
77

88
# Database Configuration
99
# ----------------------
10-
# Provide the URL for connecting to the database, This should include the protocol, username, password, host, port, and database name as applicable.
11-
# Format: protocol://username:password@host:port/databaseName
10+
# Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable.
11+
# For example, 'mongodb://root:example@localhost:27017/yonodeDB'.
12+
# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/yonodeDB' where 'db' is the name of the database service.
1213
DATABASE_URL=
1314

1415
# Authentication and Security Configuration
@@ -23,4 +24,4 @@ JWT_SECRET_KEY=
2324
# This setting can influence the application's behavior, enabling or disabling certain features based on the environment.
2425
# For example, in 'development' mode, more verbose logging might be enabled, whereas 'production' might focus on performance optimizations and error handling.
2526
# Default: development (if not specified)
26-
NODE_ENVIRONMENT=
27+
NODE_ENVIRONMENT=
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:21
2+
3+
EXPOSE 8000
4+
5+
WORKDIR /app
6+
7+
COPY . .
8+
9+
RUN npm install -g pnpm
10+
11+
RUN npm install -g nodemon
12+
13+
RUN pnpm install
14+
15+
RUN npx prisma generate
16+
17+
CMD ["nodemon", "-L", "./src/app.js"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: '3.9'
2+
3+
services:
4+
db:
5+
image: mongo:latest
6+
container_name: mongo-db
7+
ports:
8+
- '27017:27017'
9+
environment:
10+
MONGO_INITDB_ROOT_USERNAME: root
11+
MONGO_INITDB_ROOT_PASSWORD: toor
12+
restart: on-failure
13+
# healthcheck:
14+
# test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
15+
# interval: 10s
16+
# timeout: 5s
17+
# retries: 5
18+
19+
20+
server:
21+
build: .
22+
container_name: yonode-server
23+
restart: on-failure
24+
volumes:
25+
- .:/app
26+
- /app/node_modules
27+
ports:
28+
- '8000:8000'
29+
environment:
30+
DATABASE_URL: ${DATABASE_URL}
31+
SERVER_PORT: ${SERVER_PORT}
32+
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
33+
NODE_ENVIRONMENT: ${NODE_ENVIRONMENT}
34+
depends_on:
35+
- db
36+

packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/.env

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ SERVER_PORT=
88
# Database Configuration
99
# ----------------------
1010
# Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable.
11+
# For example, 'mongodb://root:example@localhost:27017/'.
12+
# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/' where 'db' is the name of the database service.
1113
DATABASE_URL=
1214

15+
1316
# Specify the name of the database to which the application will connect.
1417
# If not specified, the default database 'yonodeDB' will be used.
1518
# Default: yonodeDB
@@ -27,4 +30,4 @@ JWT_SECRET_KEY=
2730
# This setting can influence the application's behavior, enabling or disabling certain features based on the environment.
2831
# For example, in 'development' mode, more verbose logging might be enabled, whereas 'production' might focus on performance optimizations and error handling.
2932
# Default: development (if not specified)
30-
NODE_ENVIRONMENT=
33+
NODE_ENVIRONMENT=
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:21
2+
3+
EXPOSE 8000
4+
5+
WORKDIR /app
6+
7+
COPY . .
8+
9+
RUN npm install -g pnpm
10+
11+
RUN npm install -g nodemon
12+
13+
RUN pnpm install
14+
15+
CMD ["nodemon", "-L", "./src/app.js"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: '3.9'
2+
3+
services:
4+
db:
5+
image: mongo:latest
6+
container_name: mongo-db
7+
ports:
8+
- '27017:27017'
9+
environment:
10+
MONGO_INITDB_ROOT_USERNAME: root
11+
MONGO_INITDB_ROOT_PASSWORD: toor
12+
restart: on-failure
13+
# healthcheck:
14+
# test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
15+
# interval: 10s
16+
# timeout: 5s
17+
# retries: 5
18+
19+
20+
server:
21+
build: .
22+
container_name: yonode-server
23+
restart: on-failure
24+
volumes:
25+
- .:/app
26+
- /app/node_modules
27+
ports:
28+
- '8000:8000'
29+
environment:
30+
DATABASE_URL: ${DATABASE_URL}
31+
SERVER_PORT: ${SERVER_PORT}
32+
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
33+
NODE_ENVIRONMENT: ${NODE_ENVIRONMENT}
34+
depends_on:
35+
- db
36+

packages/yonode-templates/JS-MongoDB-TypeORM-Auth-Template/src/config/dbConfig.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const AppDataSource = new DataSource({
1010
database: dbName,
1111
entities: [User],
1212
synchronize: true,
13+
authSource: "admin"
1314
});
1415

1516
AppDataSource.initialize()

packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/.env

+3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ SERVER_PORT=
88
# Database Configuration
99
# ----------------------
1010
# Provide the URL for connecting to the database. This should include the protocol, username, password, and host as applicable.
11+
# For example, 'mongodb://root:example@localhost:27017/'.
12+
# If you are using docker-compose, the database URL should be 'mongodb://root:toor@db:27017/' where 'db' is the name of the database service.
1113
DATABASE_URL=
1214

15+
1316
# Specify the name of the database to which the application will connect.
1417
# If not specified, the default database 'yonodeDB' will be used.
1518
# Default: yonodeDB

0 commit comments

Comments
 (0)