How to mount a single file

Mounting a single file is technically not possible. This is troublesome if you want to write to a file in the /app folder. But there is a trick that you can use to emulate the behavior.

On your local development go to the source code of your project.

  • Create a folder file_mounts with mkdir file_mounts
  • Create an empty file in that directory touch file_mounts/example.txt
  • Make a link from your root directory to that file ln -s file_mounts/example.txt example.txt
  • Add the mount folder to git: git add file_mounts
  • Edit the .platform.app.yaml file and add a mount point.
mounts:
    'file_mounts':
        source: local
        source_path: 'file_mounts'
  • git commit the changes and push them to your environment
  • You can now write to the example.txt file in the deploy hook, or during production.