Skip to content
Snippets Groups Projects
Commit d18af1bd authored by GUVEN Kemal's avatar GUVEN Kemal
Browse files

update docker back

parent 56269d70
No related branches found
No related tags found
No related merge requests found
# Nodejs Base image # Nodejs Base image
FROM node FROM node
# install and app dependencies # install and app dependencies
COPY . ./ COPY . .
RUN npm install -g @nestjs/cli RUN npm install -g @nestjs/cli
RUN npm ci RUN npm ci
RUN mkdir /dist RUN mkdir /dist
RUN mkdir /dist/config RUN mkdir /dist/config
#RUN npm run build RUN npm run build
RUN echo '\n\ RUN echo '{\n\
{\n\
"server": {\n\ "server": {\n\
"uri": "localhost",\n\ "uri": "localhost",\n\
"port": 3001\n\ "port": 3002\n\
},\n\ },\n\
"resources": {\n\ "resources": {\n\
"internshipAgreements": "internship-agreements"\n\ "internshipAgreements": "internship-agreements"\n\
},\n\ },\n\
"mongodb": {\n\ "mongodb": {\n\
"uri": "mongodb://db:27017/internship-manager"\n\ "uri": "mongodb://db:27018/internship-manager"\n\
},\n\ },\n\
"mailgun": {\n\ "mailgun": {\n\
"apiKey": "5d9beaef19aaa5bb01aa59bd48a12501-f7d687c0-d4d95492",\n\ "apiKey": "5d9beaef19aaa5bb01aa59bd48a12501-f7d687c0-d4d95492",\n\
"domain": "sandboxab7a8915c6f942d599319a95f74da7a6.mailgun.org"\n\ "domain": "sandboxab7a8915c6f942d599319a95f74da7a6.mailgun.org"\n\
}\n\ }\n\
}' >> /dist/config/config.json }' >> /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 #COPY /app/dist/config/config.template.json /app/dist/config/config.json
# start app # start app
EXPOSE 3001 CMD [ "npm", "run","start:dev" ]
CMD [ "npm", "run","start:dev" ] \ No newline at end of file
...@@ -6,17 +6,18 @@ services: ...@@ -6,17 +6,18 @@ services:
restart: always restart: always
build: . build: .
ports: ports:
- "3001:3001" - "3002:3002"
environment: environment:
- DB_URL=mongodb://db_mongo - DB_URL=mongodb://db_mongo
db: db:
image: mongo image: mongo
container_name: db_mongo container_name: db_mongo
command: mongod --port 27018
volumes: volumes:
- mongodata:/data/db - mongodata:/data/db
ports: ports:
- "27017:27017" - "27018:27018"
volumes: volumes:
mongodata: mongodata:
\ No newline at end of file \ 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