-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (35 loc) · 1.36 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
NAME=embroidery-workspace
.PHONY: test
build: Dockerfile.build
@if [ -z "$(shell docker images -q ${NAME})" ]; then make clean; fi
@make -s Dockerfile.build
# track the build timestamp in Dockerfile.build so the Dockerfile is rebuilt when dependencies change
Dockerfile.build: Dockerfile */**/packages.txt */**/requirements.txt requirements.txt packages.txt
docker build -t ${NAME} .
touch $@
clean:
rm Dockerfile.build || true
RUN_ARGS=--rm -it --volume ./:/src ${NAME}
format: build
@docker run $(RUN_ARGS) black . --exclude=""
lint: build
@docker run $(RUN_ARGS) mypy app.py
shell: build
@docker run $(RUN_ARGS) /bin/bash
test: build
@docker run $(RUN_ARGS) python -m unittest
# https://docs.streamlit.io/knowledge-base/using-streamlit/streamlit-watch-changes-other-modules-importing-app
up: build
@docker run -p "8501:8501" $(RUN_ARGS) streamlit run app.py
# https://playwright.dev/docs/docker
images: build
@docker run --net="host" --rm -it --volume ./:/src $$(docker build -q -f thumbnail.Dockerfile .) /bin/bash -c "python images.py"
dev:
-tmux kill-session -t "${NAME}"
tmux new-session -s "${NAME}" -d -n vi
tmux send-keys -t "${NAME}:vi" "vi" Enter
tmux new-window -t "${NAME}" -n shell "/bin/zsh"
tmux new-window -t "${NAME}" -n build
tmux send-keys -t "${NAME}:build" "make up" Enter
tmux select-window -t "${NAME}:vi"
tmux attach-session -t "${NAME}"