-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathjustfile
116 lines (90 loc) · 2.36 KB
/
justfile
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
set dotenv-load := false
@_default:
just --list
@_cog:
uv run --with cogapp cog -r README.md
@_fmt:
just --fmt --unstable
bootstrap *ARGS:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f ".env" ]; then
cp .env-dist .env
echo ".env created"
fi
if [ -n "${VIRTUAL_ENV-}" ]; then
python -m pip install --upgrade pip uv
else
echo "Skipping pip steps as VIRTUAL_ENV is not set"
fi
if [ ! -f "requirements.txt" ]; then
uv pip compile requirements.in --output-file requirements.txt
echo "requirements.txt created"
fi
just upgrade
if [ -f "compose.yml" ]; then
just build {{ ARGS }} --pull
fi
@build *ARGS:
docker compose build {{ ARGS }}
@console:
docker compose run --rm --no-deps utility /bin/bash
@down *ARGS:
docker compose down {{ ARGS }}
@lint *ARGS:
uv run --with pre-commit-uv pre-commit run {{ ARGS }} --all-files
@lock *ARGS:
docker compose run \
--no-deps \
--rm \
utility \
bash -c "uv pip compile {{ ARGS }} ./requirements.in \
--output-file ./requirements.txt"
@logs *ARGS:
docker compose logs {{ ARGS }}
@manage *ARGS:
docker compose run --rm --no-deps utility python -m manage {{ ARGS }}
# dump database to file
@pg_dump file='db.dump':
docker compose run \
--no-deps \
--rm \
db pg_dump \
--dbname "${DATABASE_URL:=postgres://postgres@db/postgres}" \
--file /src/{{ file }} \
--format=c \
--verbose
# restore database dump from file
@pg_restore file='db.dump':
docker compose run \
--no-deps \
--rm \
db pg_restore \
--clean \
--dbname "${DATABASE_URL:=postgres://postgres@db/postgres}" \
--if-exists \
--no-owner \
--verbose \
/src/{{ file }}
@restart *ARGS:
docker compose restart {{ ARGS }}
@run *ARGS:
docker compose run \
--no-deps \
--rm \
utility {{ ARGS }}
@start *ARGS="--detach":
just up {{ ARGS }}
@stop *ARGS:
just down {{ ARGS }}
@tail:
just logs --follow
@test *ARGS:
docker compose run \
--no-deps \
--rm \
utility python -m pytest {{ ARGS }}
@up *ARGS:
docker compose up {{ ARGS }}
@upgrade:
just lock --upgrade