diff --git a/Readme.MD b/Readme.MD new file mode 100644 index 0000000..95b6824 --- /dev/null +++ b/Readme.MD @@ -0,0 +1,40 @@ +# Run the application locally + +## Backend +1. cd in folder +```bash +cd backend +``` +2. Install dependencies +```bash +npm i +``` +3. Build the application +```bash +npm run build +``` +4. Start the application +```bash +npm run start +``` + + +## Frontend +1. cd in folder +```bash +cd frontend +``` +2. Install dependencies +```bash +npm i +``` +3. Start the application +```bash +npm run dev +``` + +# Run the application using docker +- To run the application using Docker, execute the following command in the root directory of your project: +```bash +docker-compose up +``` diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..7aaa063 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,25 @@ +# Use the official Node.js image as the base +FROM node:20-alpine + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json (if available) +COPY package*.json ./ + +# Install dependencies +RUN npm install + +RUN npm install -g typescript + +# Copy the entire project +COPY . . + +# Build the backend app +RUN npm run build + +# Expose the port the app will run on +EXPOSE 3000 + +# Start the app +CMD ["npm", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..34373e2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3.8' + +services: + frontend: + build: + context: ./frontend + dockerfile: Dockerfile + ports: + - "5173:5173" + + backend: + build: + context: ./backend + dockerfile: Dockerfile + ports: + - "3000:3000" diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..c93008a --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,23 @@ +# Use the official Node.js image as the base +FROM node:20-alpine + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json (if available) +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the entire project +COPY . . + +# Build the React.js app +RUN npm run build + +# Expose the port the app will run on +EXPOSE 5173 + +# Start the app +CMD ["npm", "run", "dev"] \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index a520023..502d0fa 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", + "dev": "vite --host", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview"