test caddy web server

This commit is contained in:
hay-kot 2021-02-11 18:42:20 -09:00
commit ef0af5a2f1
4 changed files with 36 additions and 4 deletions

21
Caddyfile Normal file
View file

@ -0,0 +1,21 @@
{
auto_https off
}
:80 {
@proxied path /api/* /docs /openapi.json
root * /app/dist
encode gzip
uri strip_suffix /
handle @proxied {
reverse_proxy http://127.0.0.1:9000
}
handle {
try_files {path}.html {path} /
file_server
}
}

View file

@ -7,7 +7,7 @@ RUN npm run build
FROM python:3.9-alpine
RUN apk add --no-cache libxml2-dev libxslt-dev libxml2
RUN apk add --no-cache libxml2-dev libxslt-dev libxml2 caddy
ENV ENV prod
EXPOSE 80
WORKDIR /app
@ -30,9 +30,11 @@ RUN apk add --update --no-cache --virtual .build-deps \
COPY ./mealie /app
COPY ./Caddyfile /app
COPY --from=build-stage /app/dist /app/dist
RUN rm -rf /app/test /app/.temp
RUN chmod +x run.sh
VOLUME [ "/app/data/" ]
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]
ENTRYPOINT ["/app/run.sh"]
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]

View file

@ -53,7 +53,8 @@ def api_routers():
if PRODUCTION:
mount_static_files()
pass
# mount_static_files()
api_routers()

8
mealie/run.sh Normal file
View file

@ -0,0 +1,8 @@
## Migrations
# TODO
## Web Server
./caddy run --config ./Caddyfile
## Start API
uvicorn app:app --host 0.0.0.0 --port 80