-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (42 loc) · 2.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
include .env
SHELL := /bin/bash
DOCKER_COMPOSE_FILE = docker-compose.yml
DOCKER_COMPOSE_APP_CONTAINER = app
CURRENT_USER_ID = $(shell id --user)
CURRENT_USER_GROUP_ID = $(shell id --group)
CURRENT_DIR = $(shell pwd)
PHP_SERVICE_NAME=app
build:
docker compose build --pull
run:
docker compose up -d
tailwind:
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npx tailwindcss -i ./styles.css -o ./public/output.css
dev:
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npx tailwindcss -i ./styles.css -o ./public/output.css --watch
stop:
docker compose stop
restart: stop run
lint:
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npx prettier . --check
lintf:
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npx prettier . --write
shell:
@docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} bash
encrypt-prod-secrets:
@$(MAKE) encrypt-secrets SECRETS_ENV=prod
decrypt-prod-secrets:
@$(MAKE) decrypt-secrets SECRETS_ENV=prod AGE_SECRET_KEY=${SOPS_AGE_PROD_SECRET_KEY}
decrypt-secrets:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" --env SOPS_AGE_KEY=${AGE_SECRET_KEY} ${DOCKER_COMPOSE_APP_CONTAINER} \
bash -c "echo 'Decrypting ${SECRETS_ENV} secrets' \
&& cd ./environment/prod/deployment/${SECRETS_ENV} \
&& sops --decrypt --input-type=dotenv --output-type=dotenv --output .env.${SECRETS_ENV}.secrets.decrypted .env.${SECRETS_ENV}.secrets \
&& echo 'Done'"
encrypt-secrets:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} \
bash -c "echo 'Encrypting ${SECRETS_ENV} secrets' \
&& cd ./environment/prod/deployment/${SECRETS_ENV} \
&& sops --encrypt --input-type=dotenv --output-type=dotenv --output .env.${SECRETS_ENV}.secrets .env.${SECRETS_ENV}.secrets.decrypted \
&& echo 'Done'"
.PHONY: build run tailwind stop restart shell encrypt-prod-secrets decrypt-prod-secrets decrypt-secrets encrypt-secrets dev