basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
10.6k stars 408 forks source link

Allow to set initial chown permissions to volume #999

Closed shyim closed 5 days ago

shyim commented 5 days ago

When you create a docker volume, only the root user can write into it.

It would be nice if we could set initial permissions for a docker volume.

That is what I typically do in my compose:

 init-perm:
        image: alpine
        volumes:
            - files:/var/www/html/files
            - theme:/var/www/html/public/theme
            - media:/var/www/html/public/media
            - thumbnail:/var/www/html/public/thumbnail
            - sitemap:/var/www/html/public/sitemap
        command: chown 82:82 /var/www/html/files /var/www/html/public/theme /var/www/html/public/media /var/www/html/public/thumbnail /var/www/html/public/sitemap

    init:
        image: local
        build:
            context: .
        env_file: .app.env
        entrypoint: /setup
        volumes:
            - files:/var/www/html/files
            - theme:/var/www/html/public/theme
            - media:/var/www/html/public/media
            - thumbnail:/var/www/html/public/thumbnail
            - sitemap:/var/www/html/public/sitemap
        depends_on:
            db:
                condition: service_started
            init-perm:
                condition: service_completed_successfully
shyim commented 5 days ago

whoopsiee https://github.com/basecamp/kamal/issues/897