I'm new to docker and erlang. I've installed docker and VSCode on my windows machine and I want to learn to develop erlang in the container, so I created Dockerfile:
FROM erlang:latest
WORKDIR /project
COPY . .
and .devcontainer directory with devcontainer.json file:
{
"name": "Erlang dev container",
"context": ".",
"dockerFile": "Dockerfile",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": []
}
After I opened my project folder in container I can issue bash commands and I can start erl but when I try to ask rebar to test my code with
rebar eunit
or
rebar3 eunit
I get error:
can't find include lib "eunit/lib/eunit.hrl"
What did I do wrong? Is the erlang:latest image supposed to be used for erlang development? How to fix it?
In order to use eunit
, when I run erlang programs in the shell (not using docker), I use the following -include_lib
directive:
-include_lib("eunit/include/eunit.hrl").
You seem to be using a different path:
eunit/lib/eunit.hrl
in container I can issue bash commands
Then use bash commands to search for the file eunit.hrl
.
You can always just copy the file eunit.hrl and put it in the src
directory of your rebar project, then in your module use:
-include("eunit.hrl")
I'm new to docker and erlang.
If worst comes to worst, don't worry about eunit. There is a lot to learn about erlang before you will need a testing framework.