Skip to content

Commit 014366c

Browse files
Merge pull request #11 from crunchloop/feat/setup-postgress-and-type-orm
Feat/setup postgress and type orm
2 parents a5de2f5 + 4cf4192 commit 014366c

17 files changed

+8553
-5182
lines changed

.devcontainer/devcontainer.json

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
13
{
2-
"name": "crunchloop-nestjs-interview",
4+
"name": "Existing Docker Compose (Extend)",
35

4-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
5-
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-18",
6+
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
7+
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
8+
"dockerComposeFile": [
9+
"../docker-compose.yml",
10+
"docker-compose.yml"
11+
],
612

7-
// Set the workspace folder
8-
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
13+
// The 'service' property is the name of the service for the container that VS Code should
14+
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
15+
"service": "app",
916

10-
// Features to add to the dev container. More info: https://containers.dev/features.
11-
"features": {
12-
"ghcr.io/devcontainers-contrib/features/nestjs-cli:2": {}
13-
},
17+
// The optional 'workspaceFolder' property is the path VS Code should open by default when
18+
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
19+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
1420

15-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
16-
"forwardPorts": [3000],
21+
// Features to add to the dev container. More info: https://containers.dev/features.
22+
"features": {
23+
"ghcr.io/devcontainers-extra/features/nestjs-cli:2": {}
24+
}
1725

18-
// Use 'postCreateCommand' to run commands after the container is created.
19-
"postCreateCommand": "npm install",
26+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
27+
// "forwardPorts": [],
2028

21-
// Configure tool-specific properties.
22-
"customizations": {
23-
"vscode": {
24-
"extensions": [
25-
"Postman.postman-for-vscode"
26-
]
27-
}
28-
}
29+
// Uncomment the next line if you want start specific services in your Docker Compose config.
30+
// "runServices": [],
2931

30-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
31-
// "remoteUser": "root"
32+
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
33+
// "shutdownAction": "none",
34+
35+
// Uncomment the next line to run commands after the container is created.
36+
// "postCreateCommand": "cat /etc/os-release",
37+
38+
// Configure tool-specific properties.
39+
// "customizations": {},
40+
41+
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
42+
// "remoteUser": "devcontainer"
3243
}

.devcontainer/docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
version: '3.8'
2+
services:
3+
# Update this to the name of the service you want to work with in your docker-compose.yml file
4+
app:
5+
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
6+
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
7+
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
8+
# array). The sample below assumes your primary file is in the root of your project.
9+
#
10+
# build:
11+
# context: .
12+
# dockerfile: .devcontainer/Dockerfile
13+
14+
volumes:
15+
# Update this to wherever you want VS Code to mount the folder of your project
16+
- ..:/workspaces:cached
17+
18+
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
19+
# cap_add:
20+
# - SYS_PTRACE
21+
# security_opt:
22+
# - seccomp:unconfined
23+
24+
# Overrides default command so things don't shut down after the process ends.
25+
command: sleep infinity
26+

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Node.js
1313
uses: actions/setup-node@v3
1414
with:
15-
node-version: 16
15+
node-version: 18
1616

1717
- name: Install npm dependencies
1818
run: npm ci

docker-compose.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: '3.8'
2+
services:
3+
app:
4+
image: mcr.microsoft.com/devcontainers/typescript-node:0-18
5+
volumes:
6+
- .:/workspaces/nestjs-interview
7+
ports:
8+
- "3000:3000"
9+
environment:
10+
- DB_HOST=postgres
11+
- DB_PORT=5432
12+
- DB_USERNAME=postgres
13+
- DB_PASSWORD=postgres
14+
- DB_DATABASE=nestjs_db
15+
depends_on:
16+
- postgres
17+
networks:
18+
- nestjs-network
19+
20+
postgres:
21+
image: postgres:latest
22+
environment:
23+
- POSTGRES_USER=postgres
24+
- POSTGRES_PASSWORD=postgres
25+
- POSTGRES_DB=nestjs_db
26+
ports:
27+
- "5432:5432"
28+
volumes:
29+
- postgres_data:/var/lib/postgresql/data
30+
networks:
31+
- nestjs-network
32+
33+
networks:
34+
nestjs-network:
35+
driver: bridge
36+
37+
volumes:
38+
postgres_data:

eslint.config.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// @ts-check
2+
import eslint from '@eslint/js';
3+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4+
import globals from 'globals';
5+
import tseslint from 'typescript-eslint';
6+
7+
export default tseslint.config(
8+
{
9+
ignores: ['eslint.config.mjs'],
10+
},
11+
eslint.configs.recommended,
12+
...tseslint.configs.recommendedTypeChecked,
13+
eslintPluginPrettierRecommended,
14+
{
15+
languageOptions: {
16+
globals: {
17+
...globals.node,
18+
...globals.jest,
19+
},
20+
sourceType: 'commonjs',
21+
parserOptions: {
22+
projectService: true,
23+
tsconfigRootDir: import.meta.dirname,
24+
},
25+
},
26+
},
27+
{
28+
rules: {
29+
'@typescript-eslint/no-explicit-any': 'off',
30+
'@typescript-eslint/no-floating-promises': 'warn',
31+
'@typescript-eslint/no-unsafe-argument': 'warn'
32+
},
33+
},
34+
);

0 commit comments

Comments
 (0)