Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wittmann_R507_Evaluation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WITTMANN Gregory
Wittmann_R507_Evaluation
Commits
f9d31311
Commit
f9d31311
authored
1 year ago
by
WITTMANN Gregory
Browse files
Options
Downloads
Patches
Plain Diff
Modification docker et pipline
parent
b94a7369
No related branches found
No related tags found
No related merge requests found
Pipeline
#16648
failed
1 year ago
Stage: lint
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+15
-10
15 additions, 10 deletions
.gitlab-ci.yml
calculVolumeSphere.py
+9
-7
9 additions, 7 deletions
calculVolumeSphere.py
dockerfile
+2
-2
2 additions, 2 deletions
dockerfile
with
26 additions
and
19 deletions
.gitlab-ci.yml
+
15
−
10
View file @
f9d31311
stages
:
stages
:
-
lint
-
lint
-
test
-
test
-
build
-
deploy
variables
:
variables
:
PYTEST_FLAGS
:
"
-v"
IMAGE_NAME
:
imagesphere
# Remplacez par le nom réel de votre image Docker
lint
:
lint
:
stage
:
lint
stage
:
lint
script
:
script
:
-
pip install flake8
-
apt-get update -qy
-
flake8 calculVolumeSphere.py
-
apt-get install -y python3-pip
-
pip3 install flake8
-
flake8 sphère.py
test
:
test
:
stage
:
test
stage
:
test
script
:
script
:
-
pip install -r requirements.txt
-
apt-get update -qy
-
pip install pytest
-
apt-get install -y python3-pip
-
pytest test_sphère.py
-
pip3 install -r requirements.txt
-
python3 -m pytest test_sphère.py
build
:
deploy
:
stage
:
build
stage
:
deploy
only
:
-
master
script
:
script
:
-
docker build -t EvalSpherePython .
-
echo echo "Les étapes de déploiement seront définies ultérieurement."
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
calculVolumeSphere.py
+
9
−
7
View file @
f9d31311
# sphère.py
import
os
import
math
import
math
def
calculer_volume_sphere
(
rayon
):
def
calculer_volume_sphere
(
rayon
):
...
@@ -12,13 +11,16 @@ def calculer_volume_sphere(rayon):
...
@@ -12,13 +11,16 @@ def calculer_volume_sphere(rayon):
def
enregistrer_resultat_fichier
(
volume
,
fichier
):
def
enregistrer_resultat_fichier
(
volume
,
fichier
):
with
open
(
fichier
,
'
w
'
)
as
f
:
with
open
(
fichier
,
'
w
'
)
as
f
:
f
.
write
(
f
"
{
volume
}
"
)
f
.
write
(
f
"
{
volume
}
"
)
def
main
():
def
main
():
rayon
=
float
(
input
(
"
Rayon de la sphère en cm :
"
))
# Obtenez le rayon à partir de la variable d'environnement
volume
=
calculer_volume_sphere
(
rayon
)
rayon_str
=
os
.
environ
.
get
(
"
RAYON_SPHERE
"
)
if
rayon_str
is
None
:
raise
ValueError
(
"
La variable d
'
environnement RAYON_SPHERE n
'
est pas définie.
"
)
# Enregistrement du résultat dans un fichier texte
rayon
=
float
(
rayon_str
)
volume
=
calculer_volume_sphere
(
rayon
)
enregistrer_resultat_fichier
(
volume
,
"
volume.txt
"
)
enregistrer_resultat_fichier
(
volume
,
"
volume.txt
"
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
main
()
main
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
dockerfile
+
2
−
2
View file @
f9d31311
...
@@ -5,10 +5,10 @@ FROM python:3.8
...
@@ -5,10 +5,10 @@ FROM python:3.8
RUN
apt-get update
-y
&&
apt-get
install
-y
python3-pip
RUN
apt-get update
-y
&&
apt-get
install
-y
python3-pip
# Copiez les fichiers nécessaires dans le conteneur
# Copiez les fichiers nécessaires dans le conteneur
COPY
calculVolumeSphere.py
requirements.txt
./
COPY
calculVolumeSphere.py ./
# Installez les dépendances
# Installez les dépendances
RUN
pip3
install
-r
requirements.txt
RUN
pip3
install
Flask
# Exposez le port 9090
# Exposez le port 9090
EXPOSE
9090
EXPOSE
9090
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment