Skip to content

Commit

Permalink
Merge pull request #38 from DushanSenadheera/dev
Browse files Browse the repository at this point in the history
setup docker composer
  • Loading branch information
DushanSenadheera committed May 7, 2024
2 parents 24beea1 + f2d334a commit d73805d
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 169 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Navigate to the project directory
```bash
cd project_rover
```
Install the dependencies
Install the server & client dependencies in relevent directories
```bash
npm install
```
Expand Down
1 change: 1 addition & 0 deletions client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
18 changes: 18 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Base image for client
FROM node:alpine

WORKDIR /app/client

# Install client dependencies
COPY ./package.json .
COPY ./package-lock.json .
RUN npm install

# Copy client source code
COPY ./ .

# Expose port
EXPOSE 8000

# Set entry point
CMD ["npm", "run", "dev"]
2 changes: 1 addition & 1 deletion client/src/components/Contact/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@mantine/core';
import { IconBrandTwitter, IconBrandYoutube, IconBrandInstagram } from '@tabler/icons-react';
import { ContactIconsList } from './ContactIcon';
import classes from './Contact.module.scss';
import classes from './contact.module.scss';

const social = [IconBrandTwitter, IconBrandYoutube, IconBrandInstagram];

Expand Down
8 changes: 8 additions & 0 deletions client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
watch: {
usePolling: true,
},
host: true,
port: 3000,
strictPort: true,
}
})
21 changes: 21 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3'
services:
server:
build: ./server
ports:
- 8000:8000
networks:
- mynetwork

client:
build: ./client
ports:
- 3000:3000
networks:
- mynetwork
depends_on:
- server

networks:
mynetwork:
driver: bridge
2 changes: 1 addition & 1 deletion localhost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ cd ../client
npm run dev

# Once the client has finished, kill the server
kill $server_pid
kill $server_pid
166 changes: 0 additions & 166 deletions model/src/util/recommendation system.ipynb

This file was deleted.

1 change: 1 addition & 0 deletions server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
18 changes: 18 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Base image for server
FROM node:alpine

WORKDIR /app/server

# Install server dependencies
COPY ./package.json .
COPY ./package-lock.json .
RUN npm install

# Copy server source code
COPY ./ .

# Expose ports
EXPOSE 3000

# Set entry point
CMD ["npm", "start"]
4 changes: 4 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ app.use('/', foodRoute)
app.use('/', stayRoute)
app.use('/', locationRoute)

app.get('/', (req, res) => {
res.send('Welcome to Rover API')
})

app.listen(process.env.PORT, () => {
console.log(`server is listening on port ${process.env.PORT}!`)
})
Expand Down

0 comments on commit d73805d

Please sign in to comment.