Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.git
dist
.env
*.log
14 changes: 14 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Client Dockerfile
FROM node:20-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 5173

CMD ["npm","run","dev","--", "--host"]
14,234 changes: 6,974 additions & 7,260 deletions client/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
"eslint-plugin-react-refresh": "^0.4.3",
"postcss": "^8.4.29",
"tailwindcss": "^3.3.3",
"vite": "^4.4.5"
"vite": "^7.0.0"
}
}
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3.8'

services:
client:
build: ./client
ports:
- "5173:5173"
depends_on:
- server
networks:
- joblane-network

server:
build: ./server
ports:
- "5000:5000"
environment:
- MONGO_URI=mongodb://mongo:27017/joblane
depends_on:
- mongo
networks:
- joblane-network

mongo:
image: mongo:7
ports:
- "27017:27017"
volumes:
- mongo_data:/data/db
networks:
- joblane-network

volumes:
mongo_data:

networks:
joblane-network:
driver: bridge
4 changes: 4 additions & 0 deletions server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.env
*.log
dist
14 changes: 14 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:20-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm","start"]

15 changes: 13 additions & 2 deletions server/config/database.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
const mongoose = require('mongoose')

const databaseConnection = () => {
mongoose.connect(process.env.DB,{
const dbUri = process.env.DB && process.env.DB.trim()

if (!dbUri) {
console.error('ERROR: Missing required environment variable DB.')
console.error('Set DB in server/config/config.env or run Docker with --env-file /path/to/config.env or -e DB=...')
process.exit(1)
}

mongoose.connect(dbUri, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then((data)=>{
}).then((data) => {
console.log(`database connected successfully at server ${data.connection.host}`)
}).catch((err) => {
console.error('MongoDB connection failed:', err.message || err)
process.exit(1)
})
}

Expand Down
Loading
Loading