maven
This commit is contained in:
16
proiect-nutritie-java/Dockerfile
Normal file
16
proiect-nutritie-java/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
# Docker va descărca singur Python și Pip în interiorul imaginii
|
||||
FROM python:3.9-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copiem fișierul de dependințe
|
||||
COPY requirements.txt .
|
||||
|
||||
# Aici Docker va rula 'pip install' în interiorul lui, nu pe Ubuntu al tău
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["python", "app/main.py"]
|
||||
40
proiect-nutritie-java/Jenkinsfile
vendored
Normal file
40
proiect-nutritie-java/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
tools {
|
||||
maven 'MVN-WSL'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Maven Analysis') {
|
||||
steps {
|
||||
sh 'mvn --version'
|
||||
echo 'Maven a fost integrat cu succes în pipeline-ul de Python!'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Docker Image') {
|
||||
steps {
|
||||
dir('proiect-nutritie') {
|
||||
sh 'docker build -t dieta-app-jenkins .'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
sh '''
|
||||
docker stop test-dieta || true
|
||||
docker rm test-dieta || true
|
||||
docker run -d -p 8085:5000 --name test-dieta dieta-app-jenkins
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
proiect-nutritie-java/pom.xml
Normal file
10
proiect-nutritie-java/pom.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.nutritie</groupId>
|
||||
<artifactId>nutritie-webapp</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Nutritie Java Edition</name>
|
||||
<finalName>nutritie</finalName>
|
||||
</project>
|
||||
81
proiect-nutritie-java/src/main/webapp/index.html
Normal file
81
proiect-nutritie-java/src/main/webapp/index.html
Normal file
@@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ro">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Nutriție AI Pro</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body class="p-5 bg-light">
|
||||
<div class="container" style="max-width: 600px;">
|
||||
<h1 class="mb-4 text-center">Calculator Kcal & AI Menu</h1>
|
||||
|
||||
<div class="card p-4 shadow-sm">
|
||||
<form action="/calculate" method="post">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Greutate actuală (kg)</label>
|
||||
<input type="number" name="weight" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Înălțime (cm)</label>
|
||||
<input type="number" name="height" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Vârstă</label>
|
||||
<input type="number" name="age" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Sex</label>
|
||||
<select name="gender" class="form-select">
|
||||
<option value="masculin">Masculin</option>
|
||||
<option value="feminin">Feminin</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Nivel activitate</label>
|
||||
<select name="activity" class="form-select">
|
||||
<option value="1.2">Sedentar (birou)</option>
|
||||
<option value="1.55">Activ (3-5 zile sport)</option>
|
||||
<option value="1.9">Extrem (muncă fizică/sport zilnic)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Obiectiv</label>
|
||||
<select name="goal" class="form-select">
|
||||
<option value="mentinere">Menținere</option>
|
||||
<option value="slabire">Slăbire (-500 kcal)</option>
|
||||
<option value="ingrasare">Îngrășare (+500 kcal)</option>
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success w-100">Calculează</button>
|
||||
</form>
|
||||
|
||||
{% if rezultat %}
|
||||
<div class="mt-4 alert alert-info text-center">
|
||||
<h4>Ținta ta: {{ rezultat }} kcal / zi</h4>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<h5>🤖 Cere meniu de la AI</h5>
|
||||
<form action="/calculate" method="post">
|
||||
<input type="hidden" name="weight" value="{{ request.form.weight }}">
|
||||
<input type="hidden" name="height" value="{{ request.form.height }}">
|
||||
<input type="hidden" name="age" value="{{ request.form.age }}">
|
||||
<input type="hidden" name="gender" value="{{ request.form.gender }}">
|
||||
<input type="hidden" name="activity" value="{{ request.form.activity }}">
|
||||
<input type="hidden" name="goal" value="{{ request.form.goal }}">
|
||||
|
||||
<textarea name="preferences" class="form-control mb-2" placeholder="Ex: Sunt vegetarian, nu îmi place peștele..."></textarea>
|
||||
<button type="submit" class="btn btn-outline-primary btn-sm w-100">Generează Meniu Personalizat</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if meniu_ai %}
|
||||
<div class="mt-4 p-3 border rounded bg-white">
|
||||
<h6 class="text-primary font-weight-bold">Meniul tău generat:</h6>
|
||||
<p style="white-space: pre-line;">{{ meniu_ai }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user