vault-ai
vault-ai copied to clipboard
Add Docker support using Alpine base image
This PR adds Docker support to the application by introducing a multi-stage Dockerfile with an Alpine base image to minimize the final image size. The Dockerfile is divided into three stages:
- Build the Go backend.
- Build the React frontend.
- Assemble the final image with the built backend, frontend, and required runtime dependencies.
Changes:
- Added Dockerfile: The new Dockerfile provides a multi-stage build process to create an optimized final image.
- Added docker-compose.yml: A docker-compose file is included to make it easier to run the application using Docker Compose.
- Updated .gitignore: Removed the Dockerfile from the .gitignore to include it in the repository.
- Updated package.json: Added new script specifically for docker start, without disturbing the manual process scripts.
- Updated README.md: Added instructions for running the application using Docker.
How to test:
- Ensure Docker and Docker Compose are installed on your system.
- Run
docker-compose upin the project's root directory. - Open a browser and navigate to
http://localhost:8100. The application should be running and accessible.
Additional notes:
- Special thanks to @oscarsantillana for making a PR; I got some inspiration from there to make fixes here.
- Additional testing is required before the merge, as I do not have PineCone access yet. I've tested that the platform comes up and gets the relevant errors with the OpenAI key.
- Update required to packages-lock.json file.
I'm glad my code was helpful. Please have a look at my latest commit about max file size. Might be useful to include it as an environment variable in docker-compose.
I'm glad my code was helpful. Please have a look at my latest commit about max file size. Might be useful to include it as an environment variable in docker-compose.
That's a great feature, I believe it should go in as a separate feature (with your name) once this PR gets merged.
Tested the docker compose. Works! Great work guys
I tested it as well -- as I got access to Pinecone, works fine. @pashpashpash
Stupid question maybe, but I'm trying to access this from another local machine and whatever I do I get: This site can’t provide a secure connection. This happens even if accessing over http. In the docker log I get:
vault-ai-opvault-1 | [negroni] Apr 29 17:23:36 | 200 | 1.2142ms vault-ai-opvault-1 | GET /
I guess I need to disable SSL or something, but not sure how...
Stupid question maybe, but I'm trying to access this from another local machine and whatever I do I get: This site can’t provide a secure connection. This happens even if accessing over http. In the docker log I get:
vault-ai-opvault-1 | [negroni] Apr 29 17:23:36 | 200 | 1.2142ms vault-ai-opvault-1 | GET /
I guess I need to disable SSL or something, but not sure how...
Do you have any other containers that you are able to run correctly from the same source and destination local machine? Afraid this might not be relevant to this PR.
Stupid question maybe, but I'm trying to access this from another local machine and whatever I do I get: This site can’t provide a secure connection. This happens even if accessing over http. In the docker log I get: vault-ai-opvault-1 | [negroni] Apr 29 17:23:36 | 200 | 1.2142ms vault-ai-opvault-1 | GET / I guess I need to disable SSL or something, but not sure how...
Do you have any other containers that you are able to run correctly from the same source and destination local machine? Afraid this might not be relevant to this PR.
Yes, several. It might be related to the docker setup of this PR though, I got it working with tunneling, so I think the problem is it binds to localhost. And even if I configure it to bind to my ip in the compose file, it still binds to localhost. But I'm not sure if it's hard coded in the source or something.
@Jasmin25 @UglyBob79 I think I have hit this issue too. Upon looking I found something in the index.html. Is that something that might not be letting it load on anything other than localhost?
<script type="text/javascript">
(function () {
if (
location.hostname !== 'localhost' &&
location.protocol !== 'https:'
) {
location.replace(
'https:' +
location.href.substring(location.protocol.length)
);
}
})();
</script>
Thanks for looking into it @xaksh; I can further look into a solution later tonight and update the PR with a fix, if any.
@xaksh @UglyBob79
So, I looked into it and this script forces users to use HTTPS by redirecting them if they access the page with HTTP. However, it does not redirect if the hostname is "localhost". So, how about "whitelisting" the local network IPs too?
Perhaps you could test by modifying the static/index.html to the following? It's a hack, but hey, if it works ;)
Let me know if it works, I can update the PR.
(function () {
const localNetworkPrefix = '192.168.'; // Replace this with your local network's IP address prefix
if (
location.hostname !== 'localhost' &&
!location.hostname.startsWith(localNetworkPrefix) &&
location.protocol !== 'https:'
) {
location.replace(
'https:' +
location.href.substring(location.protocol.length)
);
}
})();
Tested. Confirm it works. I think this should be handled more elegantly but since OP had it in such a way at first place, hotfix for now should be good. Question! Would setting network prefix to 0.0.0.0 allow all?
Anyways thanks! @Jasmin25
Perhaps just disabling HTTPS redirect would be a better solution till its handled by the OP themselves?
What happens when you comment out the javascript part?
Hi - has the Docker support been superseded by the latest updates? If so, I'm wondering if I should try out Jasmin25's last commit and perhaps upgrade from there? Or is there an easy fix to get it working with Docker? ....or perhaps am I unreasonably scared of installing Go etc. on my machine and should in fact just dive in! ;-)