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

Add Dockerfile #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add Dockerfile #18

wants to merge 1 commit into from

Conversation

Angel3245
Copy link
Contributor

Description

This pull request introduces a new Dockerfile designed to create an Ubuntu environment with Python. It includes the following key features:

  1. An installation of the Python environment.
  2. A shared folder (/app) between the Docker container and the host machine to facilitate easy access to project files.
  3. Installation of all project dependencies using Poetry, a dependency management tool for Python.

This setup aims to streamline the development process by providing a consistent and reproducible environment for running and developing the project.

Changes

  • Added a Dockerfile to set up an Ubuntu-based container.
  • Installed a Python environment within the container.
  • Created a shared directory (/app) between the host and the container.
  • Installed Poetry to handle project dependencies.
  • Configured the container to install all dependencies specified in pyproject.toml using Poetry.
  • Update the project's documentation to include instructions on using the new Docker setup.

Dockerfile based on Building an Efficient Docker Image with Poetry and PyTorch

Todos

  • Implement a CI/CD pipeline to build and test the Docker container.
  • Add more detailed testing scripts to verify the container setup.
  • Explore optimizations for reducing the Docker image size.

How can we see the results or reproduce them?

To see the results or reproduce the environment setup:

  1. Build the Docker image using the provided Dockerfile:

    cd p2pfl
    docker build -t p2pfl .
  2. Run a container from the image

    docker run -it -p 8000:8000 --gpus=all -v .:/app/ p2pfl

How Has This Been Tested?

  • Unit test: Verified the installation of Python within the container.
  • Integration test: Checked that the shared folder /app is correctly mounted and accessible.
  • End-to-end test: Ensured that Poetry can install all dependencies from pyproject.toml without issues.
  • System test: Ran the project within the container to confirm the environment is set up correctly. Tested in Docker 4.31.1.

How do you want others to review your code?

  • Entire diff

@pguijas
Copy link
Owner

pguijas commented Jun 22, 2024

Hi @Angel3245 ! Thank you very much for your contribution, as soon as I finish a refactor that I'm doing locally I'll merge it.

By the way, I find very interesting what you say about CI/CD and reducing the image size. How large is the image currently?

@Angel3245
Copy link
Contributor Author

Hi @Angel3245 ! Thank you very much for your contribution, as soon as I finish a refactor that I'm doing locally I'll merge it.

By the way, I find very interesting what you say about CI/CD and reducing the image size. How large is the image currently?

Hi @pguijas !

Right now the container uses around 8-9 GB of hard disk memory. It is not too much but maybe some modifications, such as avoiding the installation of some not required PyTorch or Python 3.9 dependencies, could reduce its size without affecting the final purpose of the image.

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

Successfully merging this pull request may close these issues.

None yet

2 participants