Dockerfile and co updates - #2986
Conversation
BundleMonUnchanged files (7)
No change in files bundle size Final result: ✅ View report in BundleMon website ➡️ |
| end | ||
|
|
||
| config_dir = System.get_env("CONFIG_DIR", "/run/secrets") | ||
| storage_dir = get_var_from_path_or_env(config_dir, "STORAGE_DIR", System.tmp_dir!()) |
There was a problem hiding this comment.
To make the above work we need to move all writing outside of /app, for example to /tmp.
There was a problem hiding this comment.
Sounds good to me.
After implementing this, we could use tmpfs mounts when running the container to prevent writing data into the container's writable layer.
|
Thanks! Looks good in general. For deployment, we should start with deploying to staging and test there first. |
38ed9fc to
4cd50f1
Compare
@ruslandoga could you update your fork, so we can test this on staging? |
da5b690 to
1305b80
Compare
|
I'm going to run it for a few days on my instance and report back if anything bad happens. |
| MIX_ENV=small | ||
| BUILD_METADATA=${{ steps.meta.outputs.json }} | ||
| ERL_FLAGS=+JPperf true | ||
| ERL_FLAGS=+JMsingle true |
There was a problem hiding this comment.
Seems to work, I built an arm64 image and it boots successfully on arm64 mac.
Everything seems OK! |
| maxmind_license_key = get_var_from_path_or_env(config_dir, "MAXMIND_LICENSE_KEY") | ||
| maxmind_edition = get_var_from_path_or_env(config_dir, "MAXMIND_EDITION", "GeoLite2-City") | ||
| maxmind_cache_dir = get_var_from_path_or_env(config_dir, "PERSISTENT_CACHE_DIR") | ||
| persistent_cache_dir = get_var_from_path_or_env(config_dir, "PERSISTENT_CACHE_DIR") |
There was a problem hiding this comment.
Maybe this could fallback to /tmp?
persistent_cache_dir = get_var_from_path_or_env(config_dir, "PERSISTENT_CACHE_DIR") || System.tmp_dir!()| config :tzdata, | ||
| :data_dir, | ||
| get_var_from_path_or_env(config_dir, "STORAGE_DIR", Application.app_dir(:tzdata, "priv")) | ||
| config :tzdata, :data_dir, persistent_cache_dir || Path.join(System.tmp_dir!(), "tzdata_data") |
There was a problem hiding this comment.
Should it be scoped to tzdata_data dir in both cases?
config :tzdata, :data_dir, Path.join(persistent_cache_dir || System.tmp_dir!(), "tzdata_data")|
Closing in favor of #3811 |
Changes
This PR explores possible changes to the current docker build setup:
.dockerignorethat stopsdocker buildfrom copying ~300MB into the build context (this speeds up builds on mac a bit (~10s) since macs use a vm for docker host and it seems like copying these node_modules and co into the vm is slow)rootas/appowner and allowsplausibleto read and execute stuff in/appand write to/tmpor user-set locations (like volumes, etc.) via env vars (fixes Hardcoded docker user causes problems #1404)SOME MANUAL CHECKS HERE
And after adding
user: 1010:1010toplausibleindocker-compose.yml:Tests
user: 1010:1010set in docker composeChangelog
Documentation
Dark mode