NOTE: If you happen to end up here 'by the hands of Google' or some other (mis)fortune - please have a look at the solution
I use Cesar William Alvarenga's setup
to get going - and I'm OK for the db, and for the build of phoenix and, heck, I'm even good for the docker-compose run --rm phoenix mix test
like this (my app is named battery_rehab - but otherwise it's a 1:1)
√ battery.rehab % docker-compose run --rm battery_rehab mix test
Creating batteryrehab_battery_rehab_run ... done
Compiling 17 files (.ex)
Generated battery_rehab app
...
Finished in 0.4 seconds (0.2s async, 0.2s sync)
3 tests, 0 failures
Randomized with seed 941225
√ battery.rehab %
- but when I try to get that thing really going - it barf's a 139 at me!?
?139 battery.rehab % docker-compose run --rm battery_rehab mix phx.server
Creating batteryrehab_battery_rehab_run ... done
[info] Running BatteryRehabWeb.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
[debug] Downloading esbuild from https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.12.18.tgz
[info] Access BatteryRehabWeb.Endpoint at http://localhost:4000
ERROR: 139
?139 battery.rehab %
Weird thing is that if I go into "bash-land" and do it by hand it doesn't even leave a erl_crash.dump behind?
√ battery.rehab % x bash
Creating batteryrehab_battery_rehab_run ... done
root@d46b1158b169:/app# mix phx.server
[info] Running BatteryRehabWeb.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
[debug] Downloading esbuild from https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.12.18.tgz
[info] Access BatteryRehabWeb.Endpoint at http://localhost:4000
Segmentation fault
root@d46b1158b169:/app# ls -la
total 32
drwxr-xr-x 14 root root 448 Sep 28 16:41 .
drwxr-xr-x 1 root root 4096 Sep 28 19:08 ..
-rw-r--r-- 1 root root 159 Sep 28 16:41 .formatter.exs
-rw-r--r-- 1 root root 815 Sep 28 16:41 .gitignore
-rw-r--r-- 1 root root 703 Sep 28 16:41 README.md
drwxr-xr-x 4 root root 128 Sep 28 17:12 _build
drwxr-xr-x 5 root root 160 Sep 28 16:41 assets
drwxr-xr-x 7 root root 224 Sep 28 18:49 config
drwxr-xr-x 35 root root 1120 Sep 28 16:41 deps
drwxr-xr-x 6 root root 192 Sep 28 16:41 lib
-rw-r--r-- 1 root root 2032 Sep 28 16:41 mix.exs
-rw-r--r-- 1 root root 11454 Sep 28 16:41 mix.lock
drwxr-xr-x 5 root root 160 Sep 28 16:41 priv
drwxr-xr-x 5 root root 160 Sep 28 16:41 test
root@d46b1158b169:/app#
root@d46b1158b169:/app# mix phx -v
Phoenix v1.6.0
root@d46b1158b169:/app# elixir -v
Erlang/OTP 24 [erts-12.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
Elixir 1.12.3 (compiled with Erlang/OTP 24)
root@d46b1158b169:/app#
root@d46b1158b169:/app# iex -S mix phx.server
Erlang/OTP 24 [erts-12.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
[info] Running BatteryRehabWeb.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
[debug] Downloading esbuild from https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.12.18.tgz
[info] Access BatteryRehabWeb.Endpoint at http://localhost:4000
Interactive Elixir (1.12.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Segmentation fault
root@d46b1158b169:/app# ls -la
Savoing you the trip to "Cesar's" below you'll find the docker-compose.yml and Dockerfile:
# Dockerfile
FROM elixir:latest
RUN apt-get update && \
apt-get install -y build-essential && \
apt-get install -y postgresql-client && \
apt-get install -y inotify-tools && \
mix local.hex --force && \
mix archive.install hex phx_new 1.6.0 --force && \
mix local.rebar --force
ENV APP_HOME /app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
EXPOSE 3000
CMD ["mix", "phx.server"]
# docker-compose.yml
version: '3.6'
services:
db:
build: ./pg
image: battery_rehab_db
container_name: battery_rehab_db
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
restart: always
volumes:
- ~/src/pg_data:/var/lib/postgresql/data
battery_rehab:
build: .
image: battery_rehab_app:phoenix-1.6
volumes:
- ./src:/app
ports:
- "4000:4000"
depends_on:
- db