fix docker setup
This commit is contained in:
@@ -23,8 +23,9 @@ API_HOST=0.0.0.0
|
|||||||
# Website Configuration
|
# Website Configuration
|
||||||
# ==========================================
|
# ==========================================
|
||||||
NEXT_PUBLIC_GRIDPILOT_MODE=alpha
|
NEXT_PUBLIC_GRIDPILOT_MODE=alpha
|
||||||
NEXT_PUBLIC_SITE_URL=http://localhost:3001
|
NEXT_PUBLIC_SITE_URL=http://localhost:3000
|
||||||
NEXT_PUBLIC_API_URL=http://localhost:3000
|
NEXT_PUBLIC_API_URL=http://localhost:3001
|
||||||
|
NEXT_PUBLIC_API_BASE_URL=http://localhost:3001
|
||||||
NEXT_PUBLIC_DISCORD_URL=https://discord.gg/your-invite-code
|
NEXT_PUBLIC_DISCORD_URL=https://discord.gg/your-invite-code
|
||||||
NEXT_TELEMETRY_DISABLED=1
|
NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
|
|||||||
@@ -2,25 +2,13 @@ FROM node:20-alpine
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install bash for better shell capabilities
|
ENV NPM_CONFIG_FUND=false \
|
||||||
|
NPM_CONFIG_AUDIT=false \
|
||||||
|
NPM_CONFIG_UPDATE_NOTIFIER=false
|
||||||
|
|
||||||
RUN apk add --no-cache bash
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
# Copy package manifests and install dependencies (incl. workspaces)
|
|
||||||
COPY package.json package-lock.json ./
|
|
||||||
COPY apps/api/package.json apps/api/package.json
|
|
||||||
RUN npm ci --workspaces --include-workspace-root
|
|
||||||
RUN find ./node_modules -name "ts-node-dev" -print || true # Debugging line
|
|
||||||
|
|
||||||
# Copy sources for development (monorepo)
|
|
||||||
COPY apps/api apps/api/
|
|
||||||
COPY core core/
|
|
||||||
COPY adapters adapters/
|
|
||||||
COPY apps/api/tsconfig.json apps/api/
|
|
||||||
COPY tsconfig.base.json ./
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
EXPOSE 9229
|
EXPOSE 9229
|
||||||
|
|
||||||
# Command to run the NestJS application in development with hot-reloading
|
CMD ["sh", "-lc", "npm run start:dev --workspace=@gridpilot/api"]
|
||||||
# Run from the correct workspace context
|
|
||||||
CMD ["npm", "run", "start:dev", "--workspace=@gridpilot/api"]
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
import type { UseCaseOutputPort } from '@core/shared/application/UseCaseOutputPort';
|
||||||
import type { ListLeagueScoringPresetsResult, LeagueScoringPreset } from '@core/racing/application/use-cases/ListLeagueScoringPresetsUseCase';
|
import type { ListLeagueScoringPresetsResult } from '@core/racing/application/use-cases/ListLeagueScoringPresetsUseCase';
|
||||||
import type { LeagueScoringPresetsDTO } from '../dtos/LeagueScoringPresetsDTO';
|
import type { LeagueScoringPresetsDTO } from '../dtos/LeagueScoringPresetsDTO';
|
||||||
|
|
||||||
export type LeagueScoringPresetsViewModel = LeagueScoringPresetsDTO;
|
export type LeagueScoringPresetsViewModel = LeagueScoringPresetsDTO;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Provider } from '@nestjs/common';
|
|||||||
import { SponsorService } from './SponsorService';
|
import { SponsorService } from './SponsorService';
|
||||||
|
|
||||||
// Import core interfaces
|
// Import core interfaces
|
||||||
import { NotificationService } from '@core/notifications/application/ports/NotificationService';
|
import type { NotificationService } from '@core/notifications/application/ports/NotificationService';
|
||||||
import type { IPaymentRepository } from '@core/payments/domain/repositories/IPaymentRepository';
|
import type { IPaymentRepository } from '@core/payments/domain/repositories/IPaymentRepository';
|
||||||
import type { IWalletRepository } from '@core/payments/domain/repositories/IWalletRepository';
|
import type { IWalletRepository } from '@core/payments/domain/repositories/IWalletRepository';
|
||||||
// Remove the missing import
|
// Remove the missing import
|
||||||
@@ -170,7 +170,7 @@ export const SponsorProviders: Provider[] = [
|
|||||||
{
|
{
|
||||||
provide: NOTIFICATION_SERVICE_TOKEN,
|
provide: NOTIFICATION_SERVICE_TOKEN,
|
||||||
useFactory: (logger: Logger): NotificationService => ({
|
useFactory: (logger: Logger): NotificationService => ({
|
||||||
async sendNotification(command: any): Promise<void> {
|
async sendNotification(command: Parameters<NotificationService['sendNotification']>[0]): Promise<void> {
|
||||||
logger.info('[InMemoryNotificationService] sendNotification', { command });
|
logger.info('[InMemoryNotificationService] sendNotification', { command });
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -2,23 +2,12 @@ FROM node:20-alpine
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install bash for better shell capabilities
|
ENV NPM_CONFIG_FUND=false \
|
||||||
|
NPM_CONFIG_AUDIT=false \
|
||||||
|
NPM_CONFIG_UPDATE_NOTIFIER=false
|
||||||
|
|
||||||
RUN apk add --no-cache bash
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
# Copy package manifests and install dependencies (incl. workspaces)
|
|
||||||
COPY package.json package-lock.json ./
|
|
||||||
COPY apps/website/package.json apps/website/package.json
|
|
||||||
RUN npm ci --workspaces --include-workspace-root
|
|
||||||
RUN find ./node_modules -name "next" -print || true # Debugging line
|
|
||||||
|
|
||||||
# Copy sources for development (monorepo)
|
|
||||||
COPY apps/website apps/website/
|
|
||||||
COPY core core/
|
|
||||||
COPY adapters adapters/
|
|
||||||
COPY scripts scripts/
|
|
||||||
COPY tsconfig.base.json ./
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Run from the correct workspace context
|
CMD ["sh", "-lc", "npm run dev --workspace=@gridpilot/website"]
|
||||||
CMD ["npm", "run", "dev", "--workspace=@gridpilot/website"]
|
|
||||||
@@ -17,7 +17,10 @@ import Button from '@/components/ui/Button';
|
|||||||
import { ServiceFactory } from '@/lib/services/ServiceFactory';
|
import { ServiceFactory } from '@/lib/services/ServiceFactory';
|
||||||
|
|
||||||
export default async function HomePage() {
|
export default async function HomePage() {
|
||||||
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:3001';
|
const baseUrl =
|
||||||
|
process.env.API_BASE_URL ??
|
||||||
|
process.env.NEXT_PUBLIC_API_BASE_URL ??
|
||||||
|
'http://api:3000';
|
||||||
const serviceFactory = new ServiceFactory(baseUrl);
|
const serviceFactory = new ServiceFactory(baseUrl);
|
||||||
const sessionService = serviceFactory.createSessionService();
|
const sessionService = serviceFactory.createSessionService();
|
||||||
const landingService = serviceFactory.createLandingService();
|
const landingService = serviceFactory.createLandingService();
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
services:
|
services:
|
||||||
|
deps:
|
||||||
|
image: node:20-alpine
|
||||||
|
working_dir: /app
|
||||||
|
env_file:
|
||||||
|
- .env.development
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
- NPM_CONFIG_FUND=false
|
||||||
|
- NPM_CONFIG_AUDIT=false
|
||||||
|
- NPM_CONFIG_UPDATE_NOTIFIER=false
|
||||||
|
volumes:
|
||||||
|
- ./:/app
|
||||||
|
- dev_node_modules:/app/node_modules
|
||||||
|
- dev_npm_cache:/root/.npm
|
||||||
|
command:
|
||||||
|
[
|
||||||
|
"sh",
|
||||||
|
"-lc",
|
||||||
|
"set -e; LOCK_HASH=\"$$(sha1sum package-lock.json | awk '{print $$1}')\"; MARKER=\"node_modules/.gridpilot_lock_hash_dev\"; if [ -f \"$$MARKER\" ] && [ \"$$(cat \"$$MARKER\")\" = \"$$LOCK_HASH\" ]; then echo \"[deps] node_modules up-to-date\"; else echo \"[deps] installing api+website deps (slow first time)\"; npm install --no-package-lock --workspace=./apps/api --workspace=./apps/website --include-workspace-root --no-audit --fund=false --prefer-offline; node -e \"require.resolve('ts-node-dev')\"; node -e \"require.resolve('next')\"; echo \"$$LOCK_HASH\" > \"$$MARKER\"; fi",
|
||||||
|
]
|
||||||
|
networks:
|
||||||
|
- gridpilot-network
|
||||||
|
restart: "no"
|
||||||
|
|
||||||
api:
|
api:
|
||||||
|
image: gridpilot-api-dev
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: apps/api/Dockerfile.dev
|
dockerfile: apps/api/Dockerfile.dev
|
||||||
@@ -8,21 +33,29 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3001:3000"
|
||||||
- "9229:9229"
|
- "9229:9229"
|
||||||
volumes:
|
volumes:
|
||||||
- ./apps/api:/app/apps/api
|
- ./:/app
|
||||||
- ./core:/app/core
|
- dev_node_modules:/app/node_modules
|
||||||
- ./adapters:/app/adapters
|
- dev_npm_cache:/root/.npm
|
||||||
- ./tsconfig.base.json:/app/tsconfig.base.json:ro
|
command: ["sh", "-lc", "npm run start:dev --workspace=@gridpilot/api"]
|
||||||
depends_on:
|
depends_on:
|
||||||
|
deps:
|
||||||
|
condition: service_completed_successfully
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
networks:
|
networks:
|
||||||
- gridpilot-network
|
- gridpilot-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "node", "-e", "fetch('http://localhost:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
website:
|
website:
|
||||||
|
image: gridpilot-website-dev
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: apps/website/Dockerfile.dev
|
dockerfile: apps/website/Dockerfile.dev
|
||||||
@@ -30,14 +63,20 @@ services:
|
|||||||
- .env.development
|
- .env.development
|
||||||
environment:
|
environment:
|
||||||
- NEXT_TELEMETRY_DISABLED=1
|
- NEXT_TELEMETRY_DISABLED=1
|
||||||
|
- NODE_ENV=development
|
||||||
|
- API_BASE_URL=http://api:3000
|
||||||
ports:
|
ports:
|
||||||
- "3001:3000"
|
- "3000:3000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./apps/website:/app/apps/website
|
- ./:/app
|
||||||
- ./core:/app/core
|
- dev_node_modules:/app/node_modules
|
||||||
- ./adapters:/app/adapters
|
- dev_npm_cache:/root/.npm
|
||||||
- ./scripts:/app/scripts
|
command: ["sh", "-lc", "npm run dev --workspace=@gridpilot/website"]
|
||||||
- ./tsconfig.base.json:/app/tsconfig.base.json:ro
|
depends_on:
|
||||||
|
deps:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
api:
|
||||||
|
condition: service_healthy
|
||||||
networks:
|
networks:
|
||||||
- gridpilot-network
|
- gridpilot-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -65,3 +104,5 @@ networks:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
dev_db_data:
|
dev_db_data:
|
||||||
|
dev_node_modules:
|
||||||
|
dev_npm_cache:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
api:
|
api:
|
||||||
|
image: gridpilot-api-prod
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: apps/api/Dockerfile.prod
|
dockerfile: apps/api/Dockerfile.prod
|
||||||
@@ -39,6 +40,7 @@ services:
|
|||||||
max-file: "3"
|
max-file: "3"
|
||||||
|
|
||||||
website:
|
website:
|
||||||
|
image: gridpilot-website-prod
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: apps/website/Dockerfile.prod
|
dockerfile: apps/website/Dockerfile.prod
|
||||||
|
|||||||
20
package.json
20
package.json
@@ -77,18 +77,18 @@
|
|||||||
"deploy:website:prod": "npx vercel deploy --prod",
|
"deploy:website:prod": "npx vercel deploy --prod",
|
||||||
"dev": "echo 'Development server placeholder - to be configured'",
|
"dev": "echo 'Development server placeholder - to be configured'",
|
||||||
"lint": "npx eslint apps/api/src --ext .ts,.tsx --max-warnings 0",
|
"lint": "npx eslint apps/api/src --ext .ts,.tsx --max-warnings 0",
|
||||||
"docker:dev": "docker-compose -f docker-compose.dev.yml up",
|
"docker:dev": "COMPOSE_PARALLEL_LIMIT=1 docker-compose -p gridpilot-dev -f docker-compose.dev.yml up",
|
||||||
"docker:dev:build": "docker-compose -f docker-compose.dev.yml up --build",
|
"docker:dev:build": "COMPOSE_PARALLEL_LIMIT=1 docker-compose -p gridpilot-dev -f docker-compose.dev.yml up --build",
|
||||||
"docker:dev:clean": "docker-compose -f docker-compose.dev.yml down -v",
|
"docker:dev:clean": "docker-compose -p gridpilot-dev -f docker-compose.dev.yml down -v",
|
||||||
"docker:dev:down": "docker-compose -f docker-compose.dev.yml down",
|
"docker:dev:down": "docker-compose -p gridpilot-dev -f docker-compose.dev.yml down",
|
||||||
"docker:dev:logs": "docker-compose -f docker-compose.dev.yml logs -f",
|
"docker:dev:logs": "docker-compose -p gridpilot-dev -f docker-compose.dev.yml logs -f",
|
||||||
"docker:e2e:down": "docker-compose -f docker/docker-compose.e2e.yml down",
|
"docker:e2e:down": "docker-compose -f docker/docker-compose.e2e.yml down",
|
||||||
"docker:e2e:up": "docker-compose -f docker/docker-compose.e2e.yml up -d",
|
"docker:e2e:up": "docker-compose -f docker/docker-compose.e2e.yml up -d",
|
||||||
"docker:prod": "docker-compose -f docker-compose.prod.yml up -d",
|
"docker:prod": "docker-compose -p gridpilot-prod -f docker-compose.prod.yml up -d",
|
||||||
"docker:prod:build": "docker-compose -f docker-compose.prod.yml up -d --build",
|
"docker:prod:build": "docker-compose -p gridpilot-prod -f docker-compose.prod.yml up -d --build",
|
||||||
"docker:prod:clean": "docker-compose -f docker-compose.prod.yml down -v",
|
"docker:prod:clean": "docker-compose -p gridpilot-prod -f docker-compose.prod.yml down -v",
|
||||||
"docker:prod:down": "docker-compose -f docker-compose.prod.yml down",
|
"docker:prod:down": "docker-compose -p gridpilot-prod -f docker-compose.prod.yml down",
|
||||||
"docker:prod:logs": "docker-compose -f docker-compose.prod.yml logs -f",
|
"docker:prod:logs": "docker-compose -p gridpilot-prod -f docker-compose.prod.yml logs -f",
|
||||||
"dom:process": "npx tsx scripts/dom-export/processWorkflows.ts",
|
"dom:process": "npx tsx scripts/dom-export/processWorkflows.ts",
|
||||||
"env:website:merge": "node scripts/merge-website-env.js",
|
"env:website:merge": "node scripts/merge-website-env.js",
|
||||||
"generate-templates": "npx tsx scripts/generate-templates/index.ts",
|
"generate-templates": "npx tsx scripts/generate-templates/index.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user