I have some processing that runs on my machine producing between five to ten rasters layer a day. I want to serve these layers using MapServer.

I initially start with a folder that has 300 raster layers all defined in the Mapfile. In the end I could end up with + - 1500 images. How can I serve these layers and incrementally add each new file generated to the Mapfile?

I notice that the more images I have the larger the Mapfile. Any reference to documentation and examples is welcome. Can I use variables to define my Mapfile layers. All these raster layer have a simple raster style.

In your case you might want to include in your service map file a file which holds a list of layer definition (files), then programmatically create a layer file for each or your new raster layers and then recreate the list of layer files including the one for your new layer.

You may use INCLUDE directive in map file to have simpler map file structure. Create each layer definitions in a separate file and include them in the main map file. So you have to make a copy of a layer definition map file, replace the raster name and path in it and add a new row to the master map file (e.g. INCLUDE 'new_file').

You can write script or use C pre-processor to automatize the process.