Skip to content

Commit

Permalink
dockerizing the app
Browse files Browse the repository at this point in the history
  • Loading branch information
BenrhayemRacem committed May 8, 2023
1 parent 0aa44ba commit b470266
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
node_modules/
Dockerfile
uploads/
15 changes: 15 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#stage 1
FROM node:lts as node
WORKDIR /app

COPY package.json .

COPY package-lock.json .

RUN npm install

COPY . .

RUN node_modules/.bin/nest build

CMD npm run start:prod
2 changes: 1 addition & 1 deletion backend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ServiceUnavailableException, ValidationPipe } from '@nestjs/common';
import toobusy from 'toobusy-js';
import * as toobusy from 'toobusy-js';
import * as hpp from 'hpp';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
Expand Down
23 changes: 23 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
services:
practical-ssdlc-frontend:
image: racembenrhayem/practical-ssdlc-frontend
container_name: frontend
ports:
- 80:80
hostname: frontend
networks:
- practical-ssdlc

practical-ssdlc-backend:
image: racembenrhayem/practical-ssdlc-back
container_name: backend
ports:
- 3000:3000
hostname: backend
networks:
- practical-ssdlc
volumes:
- ./backend/uploads:/app/uploads

networks:
practical-ssdlc : {}
5 changes: 5 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.angular
.vscode
Dockerfile
dist/
19 changes: 19 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#stage 1
FROM node:lts as node
WORKDIR /app

COPY package.json .

COPY package-lock.json .

RUN npm install

COPY . .
RUN node_modules/.bin/ng analytics disable --global
RUN node_modules/.bin/ng build --configuration production --aot
#stage 2
FROM nginx:alpine
COPY --from=node /app/dist/frontend /usr/share/nginx/html



0 comments on commit b470266

Please sign in to comment.