perf(docker): slight optimisation and refector
Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
@@ -9,19 +9,22 @@ stages:
|
|||||||
- lint
|
- lint
|
||||||
- test
|
- test
|
||||||
|
|
||||||
test job:
|
.setup_env: &setup_env
|
||||||
stage: test
|
before_script:
|
||||||
script:
|
|
||||||
- cd src
|
- cd src
|
||||||
- cp -r /app/__pypackages__ .
|
- cp -r /app/__pypackages__ .
|
||||||
|
- export "PYTHONPATH=/builds/Klagarge/mse2425-grp09/src:/builds/Klagarge/mse2425-grp09/src/__pypackages__/3.9/lib"
|
||||||
|
- export "PATH=/builds/Klagarge/mse2425-grp09/src/__pypackages__/3.9/bin:$PATH"
|
||||||
|
- export "FLASK_APP=app"
|
||||||
|
|
||||||
|
test job:
|
||||||
|
stage: test
|
||||||
|
<<: *setup_env
|
||||||
|
script:
|
||||||
# Set environment variables for the tests
|
# Set environment variables for the tests
|
||||||
- export FLASK_SECRET_KEY=$FLASK_SECRET_KEY
|
- export FLASK_SECRET_KEY=$FLASK_SECRET_KEY
|
||||||
|
|
||||||
# launch tests
|
# launch tests
|
||||||
- export PYTHONPATH="/builds/Klagarge/mse2425-grp09/src:/builds/Klagarge/mse2425-grp09/src/__pypackages__/3.9/lib"
|
|
||||||
- export PATH="/builds/Klagarge/mse2425-grp09/src/__pypackages__/3.9/bin:$PATH"
|
|
||||||
- export FLASK_APP=app
|
|
||||||
- pdm run pytest tests --cov --cov-report term --cov-report html
|
- pdm run pytest tests --cov --cov-report term --cov-report html
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
@@ -30,12 +33,9 @@ test job:
|
|||||||
|
|
||||||
lint job:
|
lint job:
|
||||||
stage: lint
|
stage: lint
|
||||||
|
<<: *setup_env
|
||||||
dependencies: []
|
dependencies: []
|
||||||
script:
|
script:
|
||||||
- cd src/
|
|
||||||
- cp -r /app/__pypackages__ .
|
|
||||||
- export PYTHONPATH="/builds/Klagarge/mse2425-grp09/src:/builds/Klagarge/mse2425-grp09/src/__pypackages__/3.9/lib"
|
|
||||||
- export PATH="/builds/Klagarge/mse2425-grp09/src/__pypackages__/3.9/bin:$PATH"
|
|
||||||
- pdm run flake8 --config=../tox.ini
|
- pdm run flake8 --config=../tox.ini
|
||||||
allow_failure: true # Linter can fail, fixing it is for now outside of the projects scope
|
allow_failure: true # Linter can fail, fixing it is for now outside of the projects scope
|
||||||
|
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
FROM python:3.9-slim
|
FROM python:3.10-slim
|
||||||
LABEL maintener="Rémi Heredero <remi.heredero@hevs.ch>"
|
LABEL maintener="Rémi Heredero <remi.heredero@hevs.ch>"
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends curl && \
|
pip install --no-cache-dir -U pdm && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 -
|
|
||||||
|
|
||||||
ENV PATH="/root/.local/bin:$PATH" \
|
ENV PATH="/root/.local/bin:$PATH" \
|
||||||
PDM_USE_VENV=false
|
PDM_USE_VENV=false
|
||||||
@@ -17,7 +16,5 @@ COPY src/pyproject.toml src/pdm.lock ./
|
|||||||
RUN pdm config python.use_venv false && \
|
RUN pdm config python.use_venv false && \
|
||||||
pdm install -G:all
|
pdm install -G:all
|
||||||
|
|
||||||
ENV PATH="/root/.local/bin:$PATH" \
|
ENV PYTHONPATH="/app/__pypackages__/3.9/lib" \
|
||||||
PDM_USE_VENV=false \
|
|
||||||
PYTHONPATH="/app/__pypackages__/3.9/lib" \
|
|
||||||
PATH="/app/__pypackages__/3.9/bin:$PATH"
|
PATH="/app/__pypackages__/3.9/bin:$PATH"
|
Reference in New Issue
Block a user