docker + css tweaks + samediMalin

This commit is contained in:
nessar committed 2025-10-29 01:23:15 +01:00
1 parent 865555a19b
commit 2b552cf5cd
9 files changed
+191 -11

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
# Dependencies
node_modules
npm-debug.log
yarn-error.log
# Build artifacts
dist
.angular
# IDE and editor files
.vscode
.idea
*.swp
*.swo
*~
# Git
.git
.gitignore
# Docker
Dockerfile
.dockerignore
docker-compose.yml
# Testing
coverage
.karma
*.spec.ts
# Environment files
.env
.env.local
.env.*.local
# OS files
.DS_Store
Thumbs.db
# Misc
README.md
.editorconfig
.prettierrc
.eslintrc.json
*.md
+45
View File
@@ -0,0 +1,45 @@
# Stage 1: Build the Angular application
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci --only=production=false
# Copy source code
COPY . .
# Build the application for production
RUN npm run build
# Stage 2: Production image
FROM node:20-alpine AS production
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install only production dependencies
RUN npm ci --only=production && npm cache clean --force
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
# Set environment to production
ENV NODE_ENV=production
# Expose port (default Express port)
EXPOSE 4000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD node -e "require('http').get('http://localhost:4000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
# Start the application
CMD ["node", "dist/vac-optimizer/server/server.mjs"]
+11 -6
View File
@@ -33,20 +33,25 @@
"outputMode": "server",
"ssr": {
"entry": "src/server.ts"
}
},
"allowedCommonJsDependencies": [
"deepmerge",
"moment-timezone",
"jalaali-js"
]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
"maximumWarning": "2MB",
"maximumError": "3MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "4kB",
"maximumError": "8kB"
"maximumWarning": "8kB",
"maximumError": "16kB"
}
],
"outputHashing": "all"
@@ -93,4 +98,4 @@
}
}
}
}
}
+51
View File
@@ -0,0 +1,51 @@
version: "3.8"
services:
vac-optimizer:
build:
context: .
dockerfile: Dockerfile
image: vac-optimizer:latest
container_name: vac-optimizer-prod
restart: always
ports:
- "80:4000"
environment:
- NODE_ENV=production
- PORT=4000
healthcheck:
test:
[
"CMD",
"node",
"-e",
"require('http').get('http://localhost:4000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
reservations:
cpus: "0.5"
memory: 256M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
- vac-optimizer-network
networks:
vac-optimizer-network:
driver: bridge
+33
View File
@@ -0,0 +1,33 @@
version: "3.8"
services:
vac-optimizer:
build:
context: .
dockerfile: Dockerfile
image: vac-optimizer:latest
container_name: vac-optimizer
restart: unless-stopped
ports:
- "4000:4000"
environment:
- NODE_ENV=production
- PORT=4000
healthcheck:
test:
[
"CMD",
"node",
"-e",
"require('http').get('http://localhost:4000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- vac-optimizer-network
networks:
vac-optimizer-network:
driver: bridge
+1 -1
View File
@@ -2,7 +2,7 @@
<h1>{{ title() }}</h1>
<div class="content">
<app-user-input></app-user-input>
<mat-divider [vertical]="true" style="height: 100%;"></mat-divider>
<mat-divider [vertical]="true" style="height: 80%;"></mat-divider>
<app-calendar-year></app-calendar-year>
</div>
</main>
+1 -2
View File
@@ -13,5 +13,4 @@
align-items: center;
justify-content: center;
gap: 2rem;
height: 80%;
}
}
@@ -25,7 +25,7 @@ export class CalendarYear implements OnInit {
this.selectedDates.optimizeVacations(vacationData);
}
this.isLoading.set(false);
}, 500);
}, 1);
});
}
@@ -35,6 +35,5 @@ export class CalendarYear implements OnInit {
ngOnInit(): void {
this.selectedDates = this.calendarService.getSelectedDatesForYear(this.year);
this.isLoading.set(false);
}
}
+3
View File
@@ -494,6 +494,7 @@ export class SelectedDates implements SelectedDateInterface {
this._datesSelected = [...tempDatesBackup];
this.push(new SelectedDate(DayType.CP, new DateRange<Date>(twoDaysBefore1, twoDaysBefore2)));
vacationsNumber.cp -= 2;
vacationsNumber.other += 1; // Reward: gain 1 other day
},
heuristic: this.computeHeuristics()
});
@@ -509,6 +510,7 @@ export class SelectedDates implements SelectedDateInterface {
this._datesSelected = [...tempDatesBackup];
this.push(new SelectedDate(DayType.CP, new DateRange<Date>(twoDaysAfter1, twoDaysAfter2)));
vacationsNumber.cp -= 2;
vacationsNumber.other += 1; // Reward: gain 1 other day
},
heuristic: this.computeHeuristics()
});
@@ -526,6 +528,7 @@ export class SelectedDates implements SelectedDateInterface {
this.push(new SelectedDate(DayType.CP, new DateRange<Date>(oneDayBefore, oneDayBefore)));
this.push(new SelectedDate(DayType.CP, new DateRange<Date>(oneDayAfter, oneDayAfter)));
vacationsNumber.cp -= 2;
vacationsNumber.other += 1; // Reward: gain 1 other day
},
heuristic: this.computeHeuristics()
});