Skip to content
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

Feat/docker image #473

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Feat/docker image #473

wants to merge 13 commits into from

Conversation

Odonno
Copy link
Contributor

@Odonno Odonno commented Sep 25, 2024

Provide a way to deploy a Docker image to a docker registry to use the Surrealist web interface, also with embedded json files to list the predefined instance connections.

  • Create a Dockerfile
    • build the Vite app using a node image
    • host the generated files with an nginx image, with base files non-gzipped and assets pre-gzipped using the current compression plugin
  • Add a new static file servers.json for anyone to list all connections (and setting the active connection) to use when mounting the image into a container (the first time, as localstorage is still in use)...
    • only loaded when the env variable IS_EMBEDDED is set, which is only set on vite.config.embedded.ts
    • apply a Zod-like validation of the servers.json when loaded in the BrowserAdapter so that the json file must be valid
    • ...adding a new dependency valibot (1.2Kb), lazy-loaded and so only bundled with the vite.config.embedded.ts
    • improve error handling when loading the file so that the UI is still usable even if loading json or json validation fails
    • also applying migrator to avoid errors and improving UX when loading from embedded
  • Don't forget to publish tags on surrealdb/surrealist
    • update CI to publish image automatically on release

Wasn't my intention but seems to fix #147 :)

Proof of image size:

image

@Odonno
Copy link
Contributor Author

Odonno commented Sep 25, 2024

Proof it works:

image

nginx/nginx.conf Show resolved Hide resolved
src/util/migrator.tsx Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dockerfile
2 participants