Skip to content

Example Makefile

Roman Tomjak edited this page Dec 9, 2024 · 1 revision

Example Makefile for your projects (courtesy of @bonelifer):

.DEFAULT_GOAL := default

up:
    -@if [ ! -f ./prod.env ]; then \
      docker-compose up -d;\
     else \
      env-vault prod.env docker-compose -- up -d;\
     fi ; \

edit:
    -@if [ ! -f ./prod.env ]; then \
      echo "prod.env doesn't exist, please run the command below to create the file.";\
      echo "make init";\
     else \
      env-vault edit prod.env;\
     fi ; \

decrypt:
    -@if [ ! -f ./prod.env ]; then \
      echo "prod.env doesn't exist, please run the command below to create the file.";\
      echo "make init";\
     else \
      env-vault decrypt prod.env;\
     fi ; \

encrypt:
    -@if [ ! -f ./prod.env ]; then \
      echo "prod.env doesn't exist, please run the command below to create the file.";\
      echo "make init";\
     else \
      env-vault encrypt prod.env;\
     fi ; \

init:
    -@if [ -f ./prod.env ]; then \
      echo "prod.env already exists";\
     else \
       env-vault create prod.env;\
     fi ; \

default:
    @ echo " ";\
    echo "make up      - bring up the container";\
    echo "make edit    - edit the prod.env secrets file";\
    echo "make decrypt - decrypt the prod.env secrets file";\
    echo "make encrypt - re-encrypt the prod.env secrets file";\
    echo "make init    - create the prod.env secrets file";\

Clone this wiki locally