Skip to content
Snippets Groups Projects
Unverified Commit bbc91228 authored by Kemal's avatar Kemal Committed by GitHub
Browse files

Merge pull request #12 from ivanalglave/docker-back

docker back
parents ccdb9e3d d18af1bd
No related branches found
No related tags found
No related merge requests found
.git
node_modules
dist
npm-debug.log
\ No newline at end of file
# Nodejs Base image
FROM node
# install and app dependencies
COPY . .
RUN npm install -g @nestjs/cli
RUN npm ci
RUN mkdir /dist
RUN mkdir /dist/config
RUN npm run build
RUN echo '{\n\
"server": {\n\
"uri": "localhost",\n\
"port": 3002\n\
},\n\
"resources": {\n\
"internshipAgreements": "internship-agreements"\n\
},\n\
"mongodb": {\n\
"uri": "mongodb://db:27018/internship-manager"\n\
},\n\
"mailgun": {\n\
"apiKey": "5d9beaef19aaa5bb01aa59bd48a12501-f7d687c0-d4d95492",\n\
"domain": "sandboxab7a8915c6f942d599319a95f74da7a6.mailgun.org"\n\
}\n\
}' >> /dist/config/config.json
RUN echo '{\n\
"server": {\n\
"uri": "localhost",\n\
"port": 3002\n\
},\n\
"resources": {\n\
"internshipAgreements": "internship-agreements"\n\
},\n\
"mongodb": {\n\
"uri": "mongodb://db:27018/internship-manager"\n\
},\n\
"mailgun": {\n\
"apiKey": "5d9beaef19aaa5bb01aa59bd48a12501-f7d687c0-d4d95492",\n\
"domain": "sandboxab7a8915c6f942d599319a95f74da7a6.mailgun.org"\n\
}\n\
}' >> /dist/config/config.prod.json
RUN mkdir /dist/main
RUN echo '"use strict";\n\
Object.defineProperty(exports, "__esModule", { value: true });\n\
const config_1 = require("./config");\n\
const common_1 = require("@nestjs/common");\n\
const core_1 = require("@nestjs/core");\n\
const app_module_1 = require("./app.module");\n\
async function bootstrap() {\n\
const env = process.env.NODE_ENV;\n\
const app = await core_1.NestFactory.create(app_module_1.AppModule);\n\
if (env === 'dev') {\n\
app.enableCors();\n\
}\n\
else if (env === 'prod') {\n\
}\n\
else {\n\
}\n\
await app.useGlobalPipes(new common_1.ValidationPipe({\n\
whitelist: true,\n\
forbidNonWhitelisted: true,\n\
}));\n\
await app.listen(config_1.default.server.port);\n\
}\n\
bootstrap();\n\
//# sourceMappingURL=main.js.map' >> /dist/main/main.js
#COPY /app/dist/config/config.template.json /app/dist/config/config.json
# start app
CMD [ "npm", "run","start:dev" ]
\ No newline at end of file
version: "3"
services:
back_app:
depends_on:
- db
restart: always
build: .
ports:
- "3002:3002"
environment:
- DB_URL=mongodb://db_mongo
db:
image: mongo
container_name: db_mongo
command: mongod --port 27018
volumes:
- mongodata:/data/db
ports:
- "27018:27018"
volumes:
mongodata:
\ No newline at end of file
services:
mongo:
image: mongo
container_name: mongo
ports:
- 27017:27017
restart: always
Lancer la commande suivante dans le dossier InternshipManager-Back (mongo + back) :
- docker compose up
Lancer les commandes suivantes dans le dossier gestion-front (front) :
- docker build -t front .
- docker run -it --rm -p 4200:4200 --name front-container front
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment