Little tweaks to make it work... In a devcontainer anyway....
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
FROM node:18-bullseye
|
||||
FROM node:14-bullseye
|
||||
|
||||
# Install additional tools including Ionic CLI
|
||||
# Install additional tools including Ionic CLI and build dependencies for older projects
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
curl \
|
||||
vim \
|
||||
mongodb-clients \
|
||||
python2.7 \
|
||||
python2.7-dev \
|
||||
build-essential \
|
||||
&& ln -sf /usr/bin/python2.7 /usr/bin/python \
|
||||
&& ln -sf /usr/bin/python2.7 /usr/bin/python2 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install MongoDB shell via npm (works on all architectures)
|
||||
# Note: mongosh requires Node 18+, but we're using Node 14 for legacy compatibility
|
||||
# We'll use the mongo command from the mongo container instead
|
||||
|
||||
# Install global npm packages for development
|
||||
RUN npm install -g \
|
||||
@ionic/cli \
|
||||
@@ -18,17 +26,18 @@ RUN npm install -g \
|
||||
prettier
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /workspaces/PfosiLooking
|
||||
WORKDIR /workspaces/PfosiLooking-monorepo
|
||||
|
||||
# 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
|
||||
# Install dependencies separately to avoid node-sass issues during build
|
||||
# We'll install them after container starts
|
||||
# RUN npm install
|
||||
# RUN cd app && npm install
|
||||
# RUN cd backend && npm install
|
||||
|
||||
# Keep container running
|
||||
CMD ["sleep", "infinity"]
|
||||
@@ -2,11 +2,11 @@
|
||||
"name": "PfosiLooking Full Stack",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspaces/PfosiLooking",
|
||||
"workspaceFolder": "/workspaces/PfosiLooking-monorepo",
|
||||
"shutdownAction": "stopCompose",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {
|
||||
"version": "18"
|
||||
"version": "14"
|
||||
},
|
||||
"ghcr.io/devcontainers/features/git:1": {},
|
||||
"ghcr.io/devcontainers/features/github-cli:1": {}
|
||||
@@ -28,7 +28,7 @@
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": true
|
||||
"source.fixAll.eslint": "explicit"
|
||||
},
|
||||
"emmet.includeLanguages": {
|
||||
"javascript": "javascriptreact"
|
||||
@@ -55,6 +55,6 @@
|
||||
"onAutoForward": "notify"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "npm install && cd app && npm install && cd ../backend && npm install",
|
||||
"postStartCommand": "npm run dev:all"
|
||||
"postCreateCommand": ".devcontainer/postCreateCommand.sh",
|
||||
"postStartCommand": "echo 'DevContainer ready! Run npm run dev:all to start development.'"
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ services:
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
volumes:
|
||||
- ../..:/workspaces:cached
|
||||
- /workspaces/PfosiLooking/app/node_modules
|
||||
- /workspaces/PfosiLooking/backend/node_modules
|
||||
- /workspaces/PfosiLooking-monorepo/app/node_modules
|
||||
- /workspaces/PfosiLooking-monorepo/backend/node_modules
|
||||
command: sleep infinity
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
|
||||
31
.devcontainer/postCreateCommand.sh
Executable file
31
.devcontainer/postCreateCommand.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Setting up PfosiLooking monorepo dependencies..."
|
||||
echo "Using Node version: $(node --version)"
|
||||
|
||||
# Install root dependencies first
|
||||
echo "Installing root dependencies..."
|
||||
npm install
|
||||
|
||||
echo "Installing backend dependencies..."
|
||||
cd backend && npm install
|
||||
cd ..
|
||||
|
||||
echo "Installing app dependencies (Ionic 3 with legacy packages)..."
|
||||
cd app
|
||||
|
||||
# For Node 14 and older Ionic 3 projects, we need special handling
|
||||
echo "Installing with legacy peer dependencies support..."
|
||||
if npm install --legacy-peer-deps; then
|
||||
echo "App dependencies installed successfully!"
|
||||
else
|
||||
echo "Standard install failed, trying alternative approach..."
|
||||
# Try with force flag as last resort for very old packages
|
||||
npm install --legacy-peer-deps --force
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
echo "All dependencies installed successfully!"
|
||||
echo "You can now start development with: npm run dev:all"
|
||||
Reference in New Issue
Block a user