-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
73 lines (59 loc) · 1.66 KB
/
Copy pathJustfile
File metadata and controls
73 lines (59 loc) · 1.66 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
set dotenv-load
# Set to reference the just executable
# in further recipes.
just := `command -v just`
@dev *flags:
#!/bin/bash
set -e;
# Initialize variables to avoid UB.
NO_BINSTALL=0;
# It is difficult for a shell to unintentionally
# inject a `;` to alter the behavior of this, since
# `;` are usually treated to separate commands.
#
# In the case someone wanted to alter the behavior
# of this, they would end up loosing.
for flag in {{flags}}; do
case $flag in
# Use cargo install instead of binstall.
--no-binstall)
NO_BINSTALL=1;
;;
# Fallback.
* )
;;
esac
done
if
[[ -f /.dockerenv ]] ||
grep -qE '(docker|containerd|kubepods)' /proc/1/cgroup 2>/dev/null;
then
# If we are inside a docker container we will run the commands
# directly. We asume being inside one because of the existence
# of ./.dockerenv or a group called either docker, containerd
# or kubepods.
cargo watch -s "{{just}} migrate && cargo run -p backend" 2>&1 & :;
trunk serve --config Trunk.toml 2>&1 & :;
wait;
else
# On the user's computer, we will call docker to build the image.
if !command -v docker >/dev/null 2>&1; then
echo "Please, install a linux compatible version of docker before continuing.";
exit 1;
fi
# Since `docker compose up` does not accept
# build arguments we need to build explicitly.
docker compose \
-f ./docker/dev.docker-compose.yml build \
--build-arg NO_BINSTALL="$NO_BINSTALL";
docker compose \
-f ./docker/dev.docker-compose.yml up \
--no-deps;
fi
@migrate:
#!/bin/bash
set -e
atlas schema apply \
--to "file://migrations" \
-u "$DATABASE_URL?sslmode=disable" \
--auto-approve