diff --git a/docker/Dockerfile b/docker/Dockerfile index 34553e2ed..4c4065d91 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,8 @@ # Set base image -# python:latest will get the latest version of python, on linux +# python:3.14 is the newest version the test matrix covers, and is what the +# python:latest tag resolves to today. Pinning keeps the two from drifting apart. # Get a full list of python images here: https://hub.docker.com/_/python/tags -FROM python:latest +FROM python:3.14 # set the working directory in the container WORKDIR /RocketPy diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 244b9dcff..17918c487 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,10 +1,10 @@ version: '3.8' services: - python39-linux: - image: python:3.9 + python310-linux: + image: python:3.10 volumes: - - .:/app + - ..:/app working_dir: /app command: bash -c "pip install . && pip install -r requirements-tests.txt && pytest && cd rocketpy && pytest --doctest-modules" logging: @@ -15,7 +15,7 @@ services: python312-linux: image: python:3.12 volumes: - - .:/app + - ..:/app working_dir: /app command: bash -c "pip install . && pip install -r requirements-tests.txt && pytest && cd rocketpy && pytest --doctest-modules" logging: diff --git a/docs/development/docker.rst b/docs/development/docker.rst index bc1de8745..be36ada77 100644 --- a/docs/development/docker.rst +++ b/docs/development/docker.rst @@ -37,11 +37,13 @@ Before you start, you need to install on your machine: Build the image ---------------- -To build the image, run the following command on your terminal: +To build the image, run the following command from the root of the repository +(the ``Dockerfile`` copies ``requirements.txt``, so the build context has to +be the repository, not the ``docker`` folder): .. code-block:: console - docker build -t rocketpy-image -f Dockerfile . + docker build -t rocketpy-image -f docker/Dockerfile . This will build the image and tag it as ``rocketpy-image`` (you can apply another @@ -108,10 +110,11 @@ operational system. However, it is still useful to run the unit tests on different python versions. Currently, the ``docker-compose.yml`` file is configured to run the unit tests -on python 3.9 and 3.12. +on python 3.10 and 3.12. To run the unit tests on both python versions, run the following command -**on your machine**: +**on your machine**, from inside the ``docker`` folder (the services mount +the repository root, one level up, as ``/app``): .. code-block:: console @@ -155,7 +158,7 @@ For example, to use a Windows-based image, you might change: .. code-block:: Dockerfile - FROM python:latest + FROM python:3.14 to