matreyes

matreyes

Elixir slow in devcontainer (vscode and docker)

Just wanted to share my experience:

I was suffering with my elixir vscode devcontainer (docker) environment, because tests took ~20 seconds to start running.

I tried delegating the workspace:
- ..:/workspace:delegated
This makes the shared folder (between the container and the host) to write first on the container and to be eventually consistent with the host, so it doesn’t try to sync all the time.

At the beginning it worked, but sometime at the beginning of this year (2021) slowed down again.

Finally got with this amazing post by Marcus Baguley, that recommends to change the /deps and /_build folder to somewhere outside the workspace folder:

https://stories.abletech.nz/optimising-docker-for-mac-and-elixir-130db4ecd7c3

And now it works as expected.
Totally recommended for your dev environment!

Marked As Solved

matreyes

matreyes

Oh, I discovered that It was easier than what Marcus sugested
the env variables MIX_BUILD_ROOT and MIX_DEPS_PATH overrides build_path and deps_path, so you just have to add

environment:
    MIX_BUILD_ROOT: /opt/elixir-artifacts/_build
    MIX_DEPS_PATH: /opt/elixir-artifacts/deps
volumes:
    - elixir-artifacts:/opt/elixir-artifacts

to your docker-compose :slight_smile:

Also Liked

cnck1387

cnck1387

Another benefit besides speed from moving your build deps out of your volume mount path is that you will no longer have a bunch of dependencies volume mounted back to your dev box, so things stay tidy.

It’s also a discussion point in my upcoming DockerCon talk because this concept applies to other things too like node_modules/.

egze

egze

That’s cool. Thanks for sharing

quatermain

quatermain

Did you try .dockerignore file where you can put folders to ignore and Docker will not use them for loading?

Where Next?

Popular in Questions Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <...
New
jaysoifer
Is there a way to rollback a specific migration and only that one ("skipping" all the other ones)? Would mix ecto.rollback -v 2008090...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I fore...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35953 110
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31107 143
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47849 226
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

We're in Beta

About us Mission Statement