-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
93 lines (81 loc) · 2.73 KB
/
Taskfile.yml
File metadata and controls
93 lines (81 loc) · 2.73 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# https://taskfile.dev
version: "3"
silent: true
env:
INIT_FILENAME: .initialized
dotenv:
- .env
includes:
init:
taskfile: ./Taskfile-init.yml
flatten: true
tasks:
default:
desc: "List all available tasks"
cmds:
- task --list-all
run:
desc: "Run containers"
preconditions:
- sh: test -f {{ .INIT_FILENAME }}
msg: "Please init project first (task init)"
cmds:
- cmd: docker compose up --detach
stop:
desc: "Stop containers"
cmds:
- cmd: docker compose stop
restart:
desc: "Restart containers"
cmds:
- task: stop
- task: run
# https://docs.docker.com/engine/network/ca-certs/#add-certificates-to-containers
copy-ca-cert-to-container:
desc: "Copy and install mkcert CA certificate to the container"
requires:
vars: [CONTAINER_NAME]
vars:
CA_CERT_DIR:
sh: "{{ .MKCERT_BINARY }} -CAROOT"
cmds:
- cmd: docker cp {{ .CA_CERT_DIR }}/rootCA.pem {{ .CONTAINER_NAME }}:/usr/local/share/ca-certificates/mkcert-ca-cert.crt
- cmd: docker exec --user root {{ .CONTAINER_NAME }} update-ca-certificates
copy-ca-cert-to-trust-store-in-container:
desc: "Copy and install mkcert CA certificate to the trust store in container"
requires:
vars: [ CONTAINER_NAME ]
vars:
CA_CERT_DIR:
sh: "{{ .MKCERT_BINARY }} -CAROOT"
CERT_NAME: "blumilk-environment-mkcert-root-ca-cert.pem"
SCRIPT_FILENAME: "add-ca-to-trust-store.sh"
DESTINATION_DIR: "/tmp/blumilk-environment"
cmds:
- echo "Copying {{ .SCRIPT_FILENAME }} to the container"
- cmd: docker exec {{ .CONTAINER_NAME }} mkdir --parents {{ .DESTINATION_DIR }}
- cmd: docker cp ./scripts/{{ .SCRIPT_FILENAME }} {{ .CONTAINER_NAME }}:{{ .DESTINATION_DIR }}/{{ .SCRIPT_FILENAME }}
- echo "Done"
- echo "Copying mkcert root CA cert"
- cmd: docker cp {{ .CA_CERT_DIR }}/rootCA.pem {{ .CONTAINER_NAME }}:{{ .DESTINATION_DIR }}/{{ .CERT_NAME }}
- echo "Done"
- echo "Adding mkcert to trust store in container"
- cmd: docker exec --user root --workdir {{ .DESTINATION_DIR }} {{ .CONTAINER_NAME }} sh {{ .SCRIPT_FILENAME }}
- echo "Done"
generate-certs:
desc: "Generate certificates"
deps: [_mkcert-install]
requires:
vars: [CERTS_DIRECTORY, CERT_FILENAME, KEY_FILENAME, DOMAIN]
cmds:
- cmd: "{{ .MKCERT_BINARY }} \
--cert-file={{ .CERTS_DIRECTORY }}/{{ .CERT_FILENAME }} \
--key-file={{ .CERTS_DIRECTORY }}/{{ .KEY_FILENAME }} \
-ecdsa \
{{ .DOMAIN }}"
mkcert-print-CA-location:
desc: "Print the CA certificate and key storage location"
requires:
vars: [MKCERT_BINARY]
cmds:
- cmd: "{{ .MKCERT_BINARY }} -CAROOT"