mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 22:43:34 -07:00
Make run.sh the only startup script for prod + dev
Credits to @hay-kot for run.sh script logic
This commit is contained in:
parent
3aded02ccf
commit
7ce43a8061
3 changed files with 19 additions and 10 deletions
|
@ -18,4 +18,5 @@ COPY ./mealie /app/mealie
|
||||||
|
|
||||||
RUN poetry install
|
RUN poetry install
|
||||||
|
|
||||||
CMD ["poetry", "run", "python", "mealie/app.py"]
|
RUN chmod +x /app/mealie/run.sh
|
||||||
|
CMD /app/mealie/run.sh
|
||||||
|
|
|
@ -10,8 +10,6 @@ from mealie.routes.mealplans import mealplans
|
||||||
from mealie.routes.recipe import all_recipe_routes, category_routes, recipe_crud_routes, tag_routes
|
from mealie.routes.recipe import all_recipe_routes, category_routes, recipe_crud_routes, tag_routes
|
||||||
from mealie.routes.site_settings import all_settings
|
from mealie.routes.site_settings import all_settings
|
||||||
from mealie.routes.users import users
|
from mealie.routes.users import users
|
||||||
from mealie.db import init_db
|
|
||||||
from mealie.services.image import minify
|
|
||||||
|
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
title="Mealie",
|
title="Mealie",
|
||||||
|
@ -53,8 +51,6 @@ start_scheduler()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
init_db.main()
|
|
||||||
minify.migrate_images()
|
|
||||||
|
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
"app:app",
|
"app:app",
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Get Reload Arg `run.sh reload` for dev server
|
||||||
|
ARG1=${1:-production}
|
||||||
|
|
||||||
# Initialize Database Prerun
|
# Initialize Database Prerun
|
||||||
python mealie/db/init_db.py
|
python mealie/db/init_db.py
|
||||||
python mealie/services/image/minify.py
|
python mealie/services/image/minify.py
|
||||||
|
@ -7,8 +10,17 @@ python mealie/services/image/minify.py
|
||||||
## Migrations
|
## Migrations
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
## Web Server
|
if [[ "$ARG1" = "reload" ]]
|
||||||
|
then
|
||||||
|
echo "Hot reload"
|
||||||
|
|
||||||
|
# Start API
|
||||||
|
uvicorn mealie.app:app --host 0.0.0.0 --port 9000 --reload
|
||||||
|
else
|
||||||
|
echo "Production config"
|
||||||
|
# Web Server
|
||||||
caddy start --config ./Caddyfile
|
caddy start --config ./Caddyfile
|
||||||
|
|
||||||
# Start API
|
# Start API
|
||||||
uvicorn mealie.app:app --host 0.0.0.0 --port 9000
|
uvicorn mealie.app:app --host 0.0.0.0 --port 9000
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue