Flask now serves the frontend
continuous-integration/drone the build failed
Details
continuous-integration/drone the build failed
Details
parent
f5b443d271
commit
0d693847b1
|
@ -47,7 +47,7 @@ COPY --chown=runner:runner setup.cfg setup.py ./
|
||||||
COPY \
|
COPY \
|
||||||
--from=fbuilder \
|
--from=fbuilder \
|
||||||
--chown=runner:runner \
|
--chown=runner:runner \
|
||||||
/usr/src/app/web/dist ./dist
|
/usr/src/app/web/dist ./web/dist
|
||||||
|
|
||||||
ENTRYPOINT ["python"]
|
ENTRYPOINT ["python"]
|
||||||
CMD ["app"]
|
CMD ["app"]
|
||||||
|
|
24
Makefile
24
Makefile
|
@ -8,8 +8,16 @@ MIN_COV := 0
|
||||||
WEB_DIR := web
|
WEB_DIR := web
|
||||||
|
|
||||||
|
|
||||||
# By default, just create the venv when needed
|
# =====GENERAL=====
|
||||||
|
## By default, create the venv
|
||||||
all: venv
|
all: venv
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
|
||||||
|
## Remove any temporary files
|
||||||
|
clean:
|
||||||
|
@ rm -rf '$(VENV)' '$(WEB_DIR)'/node_modules
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
|
||||||
# =====BACKEND=====
|
# =====BACKEND=====
|
||||||
|
@ -44,13 +52,6 @@ test: venv
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
|
|
||||||
|
|
||||||
## Cleaning
|
|
||||||
### Remove the venv
|
|
||||||
clean:
|
|
||||||
@ rm -rf '$(VENV)' '$(WEB_DIR)'/node_modules
|
|
||||||
.PHONY: clean
|
|
||||||
|
|
||||||
|
|
||||||
## Starting the server
|
## Starting the server
|
||||||
### Run the Quart server
|
### Run the Quart server
|
||||||
run: venv
|
run: venv
|
||||||
|
@ -82,6 +83,7 @@ fformat: node_modules
|
||||||
## Testing
|
## Testing
|
||||||
ftest: node_modules
|
ftest: node_modules
|
||||||
@ yarn --cwd '$(WEB_DIR)' test
|
@ yarn --cwd '$(WEB_DIR)' test
|
||||||
|
.PHONY: ftest
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
fbuild: node_modules
|
fbuild: node_modules
|
||||||
|
@ -94,3 +96,9 @@ fbuild: node_modules
|
||||||
dbuild:
|
dbuild:
|
||||||
@ DOCKER_BUILDKIT=1 docker build -t chewingbever/jos:dev .
|
@ DOCKER_BUILDKIT=1 docker build -t chewingbever/jos:dev .
|
||||||
.PHONY: image
|
.PHONY: image
|
||||||
|
|
||||||
|
|
||||||
|
## Run image
|
||||||
|
drun: dbuild
|
||||||
|
@ docker run --rm -it -p 5000:5000 chewingbever/jos:dev
|
||||||
|
.PHONY: drun
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
"""Main entrypoint for the program."""
|
"""Main entrypoint for the program."""
|
||||||
from quart import Quart
|
from quart import Quart
|
||||||
|
|
||||||
app = Quart("jos")
|
app = Quart("jos", static_folder="web/dist", static_url_path="/")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route('/', methods=['GET'], defaults={'path': ''})
|
||||||
async def hello():
|
@app.route('/<path:path>', methods=['GET'])
|
||||||
"""Placeholder route."""
|
async def frontend(path):
|
||||||
return "hello"
|
return await app.send_static_file("index.html")
|
||||||
|
|
||||||
|
|
||||||
app.run(host="0.0.0.0")
|
app.run(host="0.0.0.0")
|
||||||
|
|
Reference in New Issue