Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A dockerfile to set a correct environnement #43

Open
SebSwan opened this issue Feb 5, 2025 · 0 comments
Open

A dockerfile to set a correct environnement #43

SebSwan opened this issue Feb 5, 2025 · 0 comments

Comments

@SebSwan
Copy link

SebSwan commented Feb 5, 2025

Hello, i don't know python environnement, it will be welcome to add a dockerfile to easily use pyfes.

with the help of LLM, i did one file but it can be improved.

Utiliser une image Ubuntu LTS comme base

FROM ubuntu:22.04

Éviter les interactions pendant l'installation des packages

ENV DEBIAN_FRONTEND=noninteractive

Définir les variables d'environnement

ENV CONDA_DIR=/opt/conda
ENV PATH=$CONDA_DIR/bin:$PATH
ENV PYTHONUNBUFFERED=1

Installation des dépendances système

RUN apt-get update && apt-get install -y
wget
git
build-essential
cmake
&& rm -rf /var/lib/apt/lists/*

Installation de Miniforge

RUN wget -q https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniforge.sh
&& chmod +x miniforge.sh
&& ./miniforge.sh -b -p $CONDA_DIR
&& rm miniforge.sh

Configurer conda

RUN conda config --set auto_activate_base false
&& conda config --add channels conda-forge
&& conda config --set channel_priority strict

Créer l'environnement conda avec les dépendances

RUN conda create -n fes python=3.11
&& conda install -n fes -c conda-forge
hdf5
netcdf4
numpy
pyyaml
setuptools
setuptools_scm
pip
boost-cpp=1.82.0
eigen
blas
&& conda clean -afy

Activer l'environnement conda par défaut

ENV PATH=$CONDA_DIR/envs/fes/bin:$PATH
ENV CONDA_DEFAULT_ENV=fes
ENV CONDA_PREFIX=$CONDA_DIR/envs/fes

Cloner et installer PyFES

WORKDIR /opt
RUN git clone https://github.com/CNES/aviso-fes.git
&& cd aviso-fes
&& git submodule update --init --recursive
&& python setup.py install
&& cd ..
&& rm -rf aviso-fes

Créer un répertoire pour les données

RUN mkdir -p /data/fes

Créer un répertoire de travail

WORKDIR /work

Créer un volume pour les données et le code

VOLUME ["/work", "/data/fes"]

Script de vérification de l'installation

COPY <<EOF /usr/local/bin/verify_install.py
import pyfes
print(f"PyFES version {pyfes.version} installed successfully")
EOF

Vérifier l'installation au démarrage

RUN python /usr/local/bin/verify_install.py

Point d'entrée par défaut

ENTRYPOINT ["conda", "run", "-n", "fes"]
CMD ["python"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant