diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e819331 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +logs diff --git a/.gitignore b/.gitignore index 77b9a32..cc5399b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules .env /logs/ -/logs/* \ No newline at end of file +/logs/* +dist \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..78f4285 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:20-alpine + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + +EXPOSE 8001 + +CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..fe3486c --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,20 @@ +version: '3.8' +services: + mongodb: + image: mongo + container_name: mongodb + ports: + - 27017:27017 + volumes: + - mongodb_vol:/data/db + snipbe: + image: snipbe + container_name: snipsavvy_backend + ports: + - 8001:8001 + environment: + - PORT=8001 + - MONGO_URL=mongodb://mongodb:27017/snipsavvy + +volumes: + mongodb_vol: \ No newline at end of file diff --git a/package.json b/package.json index f72deb4..02ab436 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "start": "nodemon src/server.ts" + "start": "nodemon dist/server.js", + "build": "tsc -b" }, "keywords": [], "author": "", diff --git a/tsconfig.json b/tsconfig.json index a89deed..412426b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -29,7 +29,7 @@ /* Modules */ "module": "commonjs" /* Specify what module code is generated. */, - "rootDir": "./" /* Specify the root folder within your source files. */, + "rootDir": "./src" /* Specify the root folder within your source files. */, "moduleResolution": "Node10" /* Specify how TypeScript looks up a file from a given module specifier. */, // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */