Add monorepo configuration and development environment
This commit is contained in:
34
.devcontainer/Dockerfile
Normal file
34
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
FROM node:18-bullseye
|
||||
|
||||
# Install additional tools including Ionic CLI
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
vim \
|
||||
mongodb-clients \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install global npm packages for development
|
||||
RUN npm install -g \
|
||||
@ionic/cli \
|
||||
@angular/cli \
|
||||
nodemon \
|
||||
concurrently \
|
||||
eslint \
|
||||
prettier
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /workspaces/PfosiLooking
|
||||
|
||||
# Copy package files for dependency caching
|
||||
COPY package*.json ./
|
||||
COPY app/package*.json ./app/
|
||||
COPY backend/package*.json ./backend/
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
RUN cd app && npm install
|
||||
RUN cd backend && npm install
|
||||
|
||||
# Keep container running
|
||||
CMD ["sleep", "infinity"]
|
||||
18
.devcontainer/dev.env
Normal file
18
.devcontainer/dev.env
Normal file
@@ -0,0 +1,18 @@
|
||||
NODE_ENV=development
|
||||
MONGODB_URI=mongodb://admin:password@localhost:27017/urge?authSource=admin
|
||||
JWT_SECRET=your-dev-jwt-secret-here
|
||||
PORT=3069
|
||||
REACT_APP_API_URL=http://localhost:3069
|
||||
|
||||
# MongoDB
|
||||
MONGO_ROOT_USER=admin
|
||||
MONGO_ROOT_PASSWORD=password
|
||||
MONGO_EXPRESS_USER=admin
|
||||
MONGO_EXPRESS_PASSWORD=password
|
||||
|
||||
# Optional API keys for development
|
||||
GOOGLE_MAPS_API_KEY=your-google-maps-api-key
|
||||
MAIL_HOST=smtp.gmail.com
|
||||
MAIL_PORT=587
|
||||
MAIL_USER=your-email@gmail.com
|
||||
MAIL_PASS=your-email-password
|
||||
60
.devcontainer/devcontainer.json
Normal file
60
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "PfosiLooking Full Stack",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspaces/PfosiLooking",
|
||||
"shutdownAction": "stopCompose",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {
|
||||
"version": "18"
|
||||
},
|
||||
"ghcr.io/devcontainers/features/git:1": {},
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {}
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"ms-vscode.vscode-json",
|
||||
"bradlc.vscode-tailwindcss",
|
||||
"esbenp.prettier-vscode",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"ms-vscode.vscode-typescript-next",
|
||||
"formulahendry.auto-rename-tag",
|
||||
"christian-kohler.path-intellisense",
|
||||
"ms-vscode.vscode-json",
|
||||
"mongodb.mongodb-vscode"
|
||||
],
|
||||
"settings": {
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
},
|
||||
"emmet.includeLanguages": {
|
||||
"javascript": "javascriptreact"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"forwardPorts": [8100, 3069, 27017, 8081],
|
||||
"portsAttributes": {
|
||||
"8100": {
|
||||
"label": "Frontend (Ionic)",
|
||||
"onAutoForward": "notify"
|
||||
},
|
||||
"3069": {
|
||||
"label": "Backend API",
|
||||
"onAutoForward": "notify"
|
||||
},
|
||||
"27017": {
|
||||
"label": "MongoDB",
|
||||
"onAutoForward": "silent"
|
||||
},
|
||||
"8081": {
|
||||
"label": "Mongo Express",
|
||||
"onAutoForward": "notify"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "npm install && cd app && npm install && cd ../backend && npm install",
|
||||
"postStartCommand": "npm run dev:all"
|
||||
}
|
||||
70
.devcontainer/docker-compose.yml
Normal file
70
.devcontainer/docker-compose.yml
Normal file
@@ -0,0 +1,70 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
volumes:
|
||||
- ../..:/workspaces:cached
|
||||
- /workspaces/PfosiLooking/app/node_modules
|
||||
- /workspaces/PfosiLooking/backend/node_modules
|
||||
command: sleep infinity
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- MONGODB_URI=mongodb://mongo:27017/urge
|
||||
- REACT_APP_API_URL=http://localhost:3069
|
||||
- PORT=3069
|
||||
- IONIC_PORT=8100
|
||||
env_file:
|
||||
- dev.env
|
||||
networks:
|
||||
- dev-network
|
||||
depends_on:
|
||||
mongo:
|
||||
condition: service_healthy
|
||||
|
||||
mongo:
|
||||
image: mongo:4.4
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- MONGO_INITDB_DATABASE=urge
|
||||
- MONGO_INITDB_ROOT_USERNAME=admin
|
||||
- MONGO_INITDB_ROOT_PASSWORD=password
|
||||
ports:
|
||||
- "27017:27017"
|
||||
networks:
|
||||
- dev-network
|
||||
volumes:
|
||||
- mongo_data:/data/db
|
||||
- ../backend/data:/docker-entrypoint-initdb.d:ro
|
||||
healthcheck:
|
||||
test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/urge --quiet
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
mongo-express:
|
||||
image: mongo-express:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- ME_CONFIG_MONGODB_SERVER=mongo
|
||||
- ME_CONFIG_MONGODB_PORT=27017
|
||||
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
|
||||
- ME_CONFIG_MONGODB_ADMINPASSWORD=password
|
||||
- ME_CONFIG_BASICAUTH_USERNAME=admin
|
||||
- ME_CONFIG_BASICAUTH_PASSWORD=password
|
||||
ports:
|
||||
- "8081:8081"
|
||||
networks:
|
||||
- dev-network
|
||||
depends_on:
|
||||
- mongo
|
||||
|
||||
volumes:
|
||||
mongo_data:
|
||||
|
||||
networks:
|
||||
dev-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user