Add a inv start-lean option to start docker without rebuilding frontend. Also updated documentation and streamline local dev more.
This commit is contained in:
Родитель
1dc219b4fe
Коммит
2dcd947ae1
|
@ -0,0 +1,34 @@
|
|||
**/*.db.archive
|
||||
|
||||
/dockerfiles
|
||||
/docker-compose*.yml
|
||||
|
||||
.git
|
||||
**/__pycache__
|
||||
*.pyc
|
||||
.DS_Store
|
||||
*.swp
|
||||
/venv/
|
||||
/tmp/
|
||||
node_modules/
|
||||
/npm-debug.log
|
||||
network-api/networkapi/frontend/
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
|
@ -124,4 +124,4 @@ RUN pip install -r dev-requirements.txt
|
|||
COPY --chown=mozilla --from=frontend /app/node_modules ./node_modules
|
||||
|
||||
# do nothing forever - exec commands elsewhere
|
||||
# CMD tail -f /dev/null
|
||||
CMD tail -f /dev/null
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
web: /app/dockerpythonvenv/bin/python network-api/manage.py runserver 0.0.0.0:8000
|
||||
# This starts up 2 processes, one for webserver and one for frontend that
|
||||
# watches frontend files and compiles them when they change.
|
||||
|
||||
frontend-watch: npm run watch
|
||||
web: /app/dockerpythonvenv/bin/python network-api/manage.py runserver 0.0.0.0:8000
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# This starts the webserver for dev and skips frontend watching to shorten start up time.
|
||||
|
||||
web: /app/dockerpythonvenv/bin/python network-api/manage.py runserver 0.0.0.0:8000
|
|
@ -0,0 +1,6 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
backend:
|
||||
# This will start the web server and skip the frontend build step.
|
||||
command: honcho -f Procfile.dev-lean start
|
|
@ -14,8 +14,7 @@ services:
|
|||
- CHOKIDAR_INTERVAL=2000
|
||||
env_file:
|
||||
- ".env"
|
||||
# The honcho command is defined in the Procfile.dev file
|
||||
# This command starts the Django server and the frontend build process
|
||||
# This command starts the Django server and the frontend build.
|
||||
command: honcho -f Procfile.dev start
|
||||
ports:
|
||||
- "8000:8000"
|
||||
|
@ -29,6 +28,7 @@ services:
|
|||
- ./.env:/app/.env:rw
|
||||
- ./tests:/app/tests:rw
|
||||
- ./Procfile.dev:/app/Procfile.dev:rw
|
||||
- ./Procfile.dev-lean:/app/Procfile.dev-lean:rw
|
||||
- ./pyproject.toml:/app/pyproject.toml:rw
|
||||
- ./requirements.txt:/app/requirements.txt:rw
|
||||
- ./requirements.in:/app/requirements.in:rw
|
||||
|
|
|
@ -100,8 +100,6 @@ When it's done, run `inv pip-sync`.
|
|||
|
||||
#### JS
|
||||
|
||||
Dependencies live on your filesystem: you don't need to rebuild the `watch-static-files` image when installing or updating dependencies.
|
||||
|
||||
**Install packages:**
|
||||
|
||||
Use `invoke npm "install [PACKAGE]"`.
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
"tailwind": "run-p tailwind:watch sync",
|
||||
"tailwind:watch": "npm run build:tailwind -- -w",
|
||||
"test": "npm run lint",
|
||||
"watch": "wait-on http://backend:8000/cms && run-s build:clean && run-p build:js:dev build:common watch:**",
|
||||
"watch": "run-s build:clean && run-p build:js:dev build:common watch:**",
|
||||
"watch:images": "chokidar \"source/images/**/*\" -c \"npm run build:images\"",
|
||||
"watch:sass": "chokidar \"source/**/*.scss\" \"network-api/**/*.html\" -c \"npm run build:sass\""
|
||||
},
|
||||
|
|
8
tasks.py
8
tasks.py
|
@ -168,7 +168,7 @@ def setup(ctx):
|
|||
print("* Building Docker images")
|
||||
ctx.run("docker-compose build")
|
||||
initialize_database(ctx)
|
||||
print("\n* Start your dev server with:\n inv start or docker-compose up")
|
||||
print("\n* Start your dev server with:\n inv start or docker-compose up.")
|
||||
|
||||
|
||||
@task(aliases=["start", "docker-start"])
|
||||
|
@ -178,6 +178,12 @@ def start_dev(ctx):
|
|||
ctx.run("docker-compose up")
|
||||
|
||||
|
||||
@task(aliases=["start-lean", "docker-start-lean"])
|
||||
def start_lean_dev(ctx):
|
||||
"""Start the dev server without rebuilding frontend assets for a faster start up. \nWarning: this may use outdated frontend assets."""
|
||||
ctx.run("docker-compose -f docker-compose.yml -f docker-compose-lean.yml up")
|
||||
|
||||
|
||||
# Javascript shorthands
|
||||
@task(aliases=["docker-npm"])
|
||||
def npm(ctx, command):
|
||||
|
|
Загрузка…
Ссылка в новой задаче