Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ ve
.coverage
.firebase
static
public/media
default-cache
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ deploy:
test:
docker run -it -e PORT=8000 -p8000:8000 orthocal ./manage.py test

firebase:
firebase: collectstatic
firebase use --add orthocal-1d1b9
firebase deploy --only hosting

# Regenerates static/ (Django's STATIC_ROOT) via the same collectstatic
# step the Dockerfile runs at image-build time, then mirrors it into
# public/media -- matching STATIC_URL='media/' -- so Firebase Hosting
# serves these files directly from its own CDN instead of proxying every
# request through Cloud Run. Firebase's rewrite in firebase.json only
# applies as a fallback for paths that don't match a real file under
# public/, so no rewrite changes are needed for this to take effect.
collectstatic:
docker compose run --rm local ./manage.py collectstatic --noinput
rm -rf public/media
mkdir -p public/media
cp -r static/* public/media/
# servestatic pre-compresses sidecar files (.br/.gz/.zstd) for its own
# on-disk serving scheme; Firebase Hosting compresses on the fly at its
# own CDN edge and never looks for these, so they'd just be dead weight
# in the deploy.
find public/media \( -name '*.br' -o -name '*.gz' -o -name '*.zstd' \) -print0 | xargs -0 rm -f