mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #3193] [MERGED] feat: container registry friendly docker images and all-in-one container #4278
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#4278
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/3193
Author: @AndrewBastin
Created: 7/17/2023
Status: ✅ Merged
Merged: 8/23/2023
Merged by: @AndrewBastin
Base:
release/2023.8.0← Head:chore/docker-fixes📝 Commits (10+)
dd61f40chore: simplify prod docker build processa720d98feat: updated frontend docker containers to allow for runtime environment variable definitionsb86d08dfeat: initial aio container implementationae3e1eechore: small corrections581b7d4chore: correct VITE env prefix to APP7104801chore: rename frontend prod docker target into appa727aaechore: revert back environment variable prefixes to VITE_7ae2437fix: pass production and port environment variables for the backend functioningd01df5dfix: add tini as the init process for a clean signal handling for the aio container536c453feat: exit the container if any of the child processes exit out📊 Changes
23 files changed (+680 additions, -42 deletions)
View changed files
📝
.dockerignore(+2 -1)➕
aio.Caddyfile(+11 -0)➕
aio_run.mjs(+72 -0)📝
docker-compose.yml(+76 -7)➕
healthcheck.sh(+14 -0)📝
packages/hoppscotch-backend/package.json(+2 -2)📝
packages/hoppscotch-backend/prisma/schema.prisma(+1 -1)➕
packages/hoppscotch-backend/src/app.controller.ts(+9 -0)📝
packages/hoppscotch-backend/src/app.module.ts(+2 -0)📝
packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts(+4 -2)➕
packages/hoppscotch-common/src/helpers/strategies/AxiosStrategy.ts(+163 -0)📝
packages/hoppscotch-selfhost-web/index.html(+3 -0)📝
packages/hoppscotch-selfhost-web/meta.ts(+4 -4)📝
packages/hoppscotch-selfhost-web/package.json(+2 -0)➕
packages/hoppscotch-selfhost-web/prod_run.mjs(+17 -0)📝
packages/hoppscotch-selfhost-web/vite.config.ts(+10 -3)📝
packages/hoppscotch-sh-admin/index.html(+4 -1)📝
packages/hoppscotch-sh-admin/package.json(+3 -0)➕
packages/hoppscotch-sh-admin/prod_run.mjs(+18 -0)📝
packages/hoppscotch-sh-admin/src/components.d.ts(+23 -0)...and 3 more files
📄 Description
Introduction
This PR intends to do the following things at a high level:
sh-adminandselfhost-web) to have environment variables definable/updatable after build.selfhost-web,sh-adminandbackendapps in different ports.The high-level end goal of this PR is to have solid container registry friendly containers of Hoppscotch.
Things changed
.dockerignoreto ignore allnode_modulesfolders recursively as well.APP_prefix instead ofVITE_.@import-meta-env/cli,@import-meta-env/unpluginas dev dependencies tosh-adminandselfhost-web.@import-meta-env/unpluginvite plugin to do environment variable processing.index.htmlfiles insh-adminandselfhost-webfor@import-meta-env/clito replace environment variables after build.prod.Dockerfilethat builds production (container registry friendly) docker containers for the app.prod-Dockerfiledefines 4 final target images,app,backend,sh_adminandaio.prod_run.mjsforsh-adminandselfhost-webthat will be executed on runtime to set environment variables during the run ofappandsh_admincontainers.aio_run.mjsforaiocontainer to execute during its runtime.Why is this still a draft ?
There are a couple of things here that I do feel we can still improve upon after I get initial feedback and this PR is fully open:
backendandaiocontainers.There should be a PR eventually to bump Prisma version which will allow us to move into[Done]node:18-alpineinstead ofnode:18-bookworm.pnpm deployto extract the backend project out so thebackendcontainer doesn't need to have the entire monorepo (along with the deps) in its image.The AIO container doesn't deal with termination really well along with situations when either the caddy server or the backend crashes.[This has been fixed]prod_run.mjs(both of them) andaio_run.mjswhere the parsing of the placeholder messes up due to quotes in the .env file. If you run into this issue, just try removing the quotes in your .env entries, but I think we need to solve this a bit more gracefully.Things that may break/change
Environment variable defined with the[This has been reverted]VITE_will definitely be broken. We can look into impact assumptions, mitigations or to reverse this decision before opening this PR from draft status.How to test this ?
prod.Dockerfiledockerfiledocker run(Example, here is the command foraio)Checks
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.