-
-
Notifications
You must be signed in to change notification settings - Fork 35
Build backend with docker #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
318aba8
3330b18
75fdcfd
446070f
c752fa8
81c4770
40b91e5
52b8e51
2337b55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Build docker images | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [main] | ||
| merge_group: | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
|
|
||
| jobs: | ||
| build-backend: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Log in to the Container registry | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v4 | ||
|
|
||
| - name: Build | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
| context: . | ||
| pull: true # always pull dependency images | ||
| file: packaging/docker/Dockerfile | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| .direnv | ||
| .DS_Store |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to not have this as a toplevel file. I would be okay to leave the versions separate (we already have to change it in multiple places anyway) and this suggests, that this is the only place to change it (it is not). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.12 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| { | ||
| "python.autoComplete.extraPaths": [ | ||
| "backend/.venv/lib/python3.11/site-packages", | ||
| "worker/.venv/lib/python3.11/site-packages" | ||
| "backend/.venv/lib/python3.12/site-packages", | ||
| "worker/.venv/lib/python3.12/site-packages" | ||
| ], | ||
| "python.analysis.extraPaths": [ | ||
| "backend/.venv/lib/python3.11/site-packages", | ||
| "worker/.venv/lib/python3.11/site-packages" | ||
| "backend/.venv/lib/python3.12/site-packages", | ||
| "worker/.venv/lib/python3.12/site-packages" | ||
| ], | ||
| "python.analysis.typeCheckingMode": "basic", | ||
| "nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix", | ||
| "nixEnvSelector.nixFile": "${workspaceFolder}/flake.nix", | ||
| "nixEnvSelector.useFlakes": true, | ||
| "nixEnvSelector.flakeShell": "default", | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../.python-version |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| from fastapi import HTTPException | ||
| from fastapi.staticfiles import StaticFiles | ||
| from starlette.exceptions import HTTPException as StarletteHTTPException | ||
|
|
||
|
|
||
| class SPAStaticFiles(StaticFiles): | ||
| def __init__( | ||
| self, | ||
| *args, | ||
| no_cache_paths: list[str], | ||
| assets_prefix: str, | ||
| assets_cache_header: str | None, | ||
| **kwargs, | ||
| ): | ||
| super().__init__(*args, **kwargs) | ||
| self.no_cache_paths = no_cache_paths | ||
| self.assets_prefix = assets_prefix | ||
| self.assets_cache_header = assets_cache_header | ||
|
|
||
| async def get_response(self, path: str, scope): | ||
| try: | ||
| res = await super().get_response(path, scope) | ||
| if path in self.no_cache_paths: | ||
| res.headers["cache-control"] = "no-cache" | ||
| elif self.assets_cache_header is not None and path.startswith( | ||
| self.assets_prefix | ||
| ): | ||
| res.headers["cache-control"] = self.assets_cache_header | ||
| return res | ||
| except (HTTPException, StarletteHTTPException) as ex: | ||
| if ex.status_code == 404: | ||
| if path.startswith(self.assets_prefix): | ||
| # Return 404 for missing assets | ||
| raise ex | ||
| else: | ||
| res = await super().get_response("index.html", scope) | ||
| if "index.html" in self.no_cache_paths: | ||
| res.headers["cache-control"] = "no-cache" | ||
| return res | ||
| else: | ||
| raise ex |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.