Skip to content

improve docker-compose example with sops exec-file #7

@hydrargyrum

Description

@hydrargyrum

sops can take care of exporting the vars itself, no need to use shell redirection etc.

FILETEMP="$(mktemp)" && sops -d scripts/.env > $FILETEMP && sleep 3 && docker-compose --env-file $FILETEMP up -d

could be replaced with:

sops exec-file scripts/.env "docker-compose --env-file {} up -d"

Added benefits of this method:

  • sops creates the temp file with restricted permissions 0600 (unlike shell redirection which uses 0644 by default)
  • sops deletes the temp file when the command finishes
  • much shorter/simpler!

Alternatively, one can use environment directly instead of a temp file:

sops exec-env scripts/.env "docker-compose up -d"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions