-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Dockerfile and co updates #2986
Conversation
BundleMonUnchanged files (7)
No change in files bundle size Final result: ✅ View report in BundleMon website ➡️ |
config/runtime.exs
Outdated
@@ -7,6 +7,7 @@ if config_env() in [:dev, :test] do | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
@@ -48,7 +48,7 @@ jobs: | |||
build-args: | | |||
MIX_ENV=small | |||
BUILD_METADATA=${{ steps.meta.outputs.json }} | |||
ERL_FLAGS=+JPperf true | |||
ERL_FLAGS=+JMsingle true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be ready now erlang/otp#6340
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work, I built an arm64 image and it boots successfully on arm64 mac.
Everything seems OK! |
@@ -229,7 +229,7 @@ ip_geolocation_db = get_var_from_path_or_env(config_dir, "IP_GEOLOCATION_DB", ge | |||
geonames_source_file = get_var_from_path_or_env(config_dir, "GEONAMES_SOURCE_FILE") | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could fallback to /tmp
?
persistent_cache_dir = get_var_from_path_or_env(config_dir, "PERSISTENT_CACHE_DIR") || System.tmp_dir!()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
.dockerignore
that stopsdocker build
from 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)root
as/app
owner and allowsplausible
to read and execute stuff in/app
and write to/tmp
or 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:1010
toplausible
indocker-compose.yml
:Tests
user: 1010:1010
set in docker composeChangelog
Documentation
Dark mode