Skip to content

Commit

Permalink
demo setup in docker compose instead of dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHaussmann committed Apr 19, 2023
1 parent 8920831 commit 0120f09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 6 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ services:
environment:
- WATCHFILES_FORCE_POLLING=true

# for development: runs with hot reload, reloads server when the config folder changes
command: ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "2626", "--reload", "--reload-dir", "/spil_conf"]
# for development:
# Runs demo config inside mapped ./spil_hamlet_conf folder (mapped to /spil_conf inside docker)
# Starts uvicorn with hot reload (reloads server when the config folder changes)
command: >
sh -c "python -c \"import spil;import hamlet_scripts.save_examples_to_mock_fs as mfs;mfs.run()\" &&
uvicorn main:app --host 0.0.0.0 --port 2626 --reload --reload-dir /spil_conf"
# See https://www.uvicorn.org/settings/
5 changes: 0 additions & 5 deletions spil_server/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ ENV PYTHONPATH="${PYTHONPATH}:/spil:/spil_conf"
# spil_hamlet_conf contains the spil demo config
COPY ./spil_hamlet_conf /spil/spil_hamlet_conf

# Init test data
# Only used for builtin demo. Can be removed for real usage.
# PYTHONDONTWRITEBYTECODE avoids to have __pycache__ in the Image
RUN export PYTHONDONTWRITEBYTECODE=1 && python -c "import spil;import hamlet_scripts.save_examples_to_mock_fs as mfs;mfs.run()"

# App will contain the fastapi app
# Starting app:main.py is already included in the base docker image (tiangolo/uvicorn-gunicorn-fastapi)
COPY ./spil_server/fastapi/app /app

0 comments on commit 0120f09

Please sign in to comment.