Skip to content

Commit d051362

Browse files
committed
add: Makefile
1 parent 577cf58 commit d051362

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
img ?=itaru2622/fastapi:bookworm
2+
base ?=python:3.12-bookworm
3+
4+
port ?=8000
5+
sDir ?=/opt/fastapi-samples/3catchall
6+
wDir ?=${PWD}
7+
8+
build:
9+
docker build --build-arg base=${base} --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy} -t ${img} .
10+
11+
# test embeded sample to check if fastapi works.
12+
test:
13+
docker run -it --rm -p ${port}:8000 -w ${sDir} \
14+
-e http_proxy=${http_proxy} -e https_proxy=${https_proxy} -e no_proxy=${no_proxy} \
15+
-e app=main:app \
16+
-e opts='--host 0.0.0.0 --reload --reload-include "*.py" --reload-include "*.conf"' \
17+
-e pip_install_opt='--upgrade --upgrade-strategy eager' \
18+
${img}
19+
20+
# start your app, you can tune more as described in README.md, such as apt_requirements, and custom start.sh
21+
start:
22+
docker run -it --rm -p ${port}:8000 -v ${wDir}:${wDir} -w ${wDir} \
23+
-e http_proxy=${http_proxy} -e https_proxy=${https_proxy} -e no_proxy=${no_proxy} \
24+
-e app=main:app \
25+
-e opts='--host 0.0.0.0 --reload --reload-include "*.py" --reload-include "*.conf"' \
26+
-e pip_install_opt='--upgrade --upgrade-strategy eager' \
27+
${img}

0 commit comments

Comments
 (0)