version_number

This commit is contained in:
ahmed531998 2023-08-30 12:08:23 +02:00
parent 3d34443505
commit 98bf3c9eb3
3 changed files with 9 additions and 5 deletions

View File

@ -4,6 +4,9 @@ WORKDIR /backend_janet
COPY requirements_simple.txt . COPY requirements_simple.txt .
ARG version_info
ENV FLASK_APP_VERSION_INFO=${version_info}
RUN pip install -r requirements_simple.txt RUN pip install -r requirements_simple.txt
RUN rm -fr /root/.cache/* RUN rm -fr /root/.cache/*

2
Jenkinsfile vendored
View File

@ -18,7 +18,7 @@ pipeline {
stage('Building image') { stage('Building image') {
steps{ steps{
script { script {
dockerImage = docker.build imagename dockerImage = docker.build(imagename, '--build-arg version_info=${GIT_COMMIT} .')
} }
} }
} }

View File

@ -10,10 +10,11 @@ from DM import DM
import threading import threading
app = Flask(__name__) app = Flask(__name__)
url = os.getenv("FRONTEND_URL_WITH_PORT") url = os.getenv("FRONTEND_URL_WITH_PORT")
version = os.getenv("FLASK_APP_VERSION_INFO")
#first 3 were url #first 3 were url
cors = CORS(app, resources={r"/api/predict": {"origins": "*"}, cors = CORS(app, resources={r"/api/predict": {"origins": url},
r"/api/feedback": {"origins": "*"}, r"/api/feedback": {"origins": url},
r"/api/dm": {"origins": "*"}, r"/api/dm": {"origins": url},
r"/health": {"origins": "*"} r"/health": {"origins": "*"}
}) })
users = {} users = {}
@ -32,7 +33,7 @@ def user_interest_decay(token):
@app.route("/health", methods=['GET']) @app.route("/health", methods=['GET'])
def health(): def health():
if alive=="alive": if alive=="alive":
return "Success", 200 return "Success \n" + "version number: " + version, 200
else: else:
return alive, 500 return alive, 500