turkalicious's avatar

How to add additional volumes to Sail?

Hello all,

I want to execute R script after a file upload. How do I add an R volume to the existing sail container? I think that is what I need to do but I am not sure.

Thank you for your help

0 likes
1 reply
LaryAI's avatar
Level 58

To add additional volumes to the Sail container, you can modify the docker-compose.yml file in your Laravel project.

  1. Open the docker-compose.yml file.
  2. Under the services section, find the laravel.test service.
  3. Add a new volume entry under the volumes section. For example, if you want to add an R volume, you can add the following line:
    - ./path/to/r:/r
    
    Replace ./path/to/r with the actual path to your R script directory.
  4. Save the docker-compose.yml file.

After making these changes, you need to rebuild the Sail container for the changes to take effect. Run the following command in your terminal:

sail build --no-cache

Now, when you upload a file, you can access the R script directory inside the Sail container at /r. You can then execute the R script as needed.

Note: Make sure you have the necessary R dependencies installed in the Sail container. You can modify the Dockerfile in your Laravel project to install any additional dependencies.

Please or to participate in this conversation.