[Newbie] - My phx server endpoint keep loading

I am trying to run my phx fresh installed app with docker, but my app endpoint *:4000 keeps loading and nothing happens, Kindly can someone have a look at my repo and assist me. Thanks

github repo : https://github.com/hassamali/discuss

I can not even build your application using docker…

Step 7/9 : RUN apk --no-cache add inotify-tools
 ---> Running in 4e1e25cd4002
/bin/sh: 1: apk: not found

Some steps earlier you are using apt to install…

After applying the following diff, I was at least able to build and start your application.

diff --git a/Dockerfile b/Dockerfile
index fad7576..00e8070 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,7 +2,7 @@
 FROM elixir:latest

 RUN apt-get update && \
-  apt-get install -y postgresql-client
+  apt-get install -y postgresql-client inotify-tools

 # Create app directory and copy the Elixir projects into it
 RUN mkdir /app
@@ -10,12 +10,9 @@ COPY . /app
 WORKDIR /app

 # Install hex package manager
-RUN mix local.hex --force
-
-# Install inotify
-RUN apk --no-cache add inotify-tools
+RUN mix do local.hex --force, local.rebar --force

 # Compile the project
-RUN mix do compile
+RUN mix do deps.get, compile

-CMD ["/app/entrypoint.sh"]
\ No newline at end of file
+CMD ["/app/entrypoint.sh"]

I was able to fetch http://localhost:4000/ using curl after it was started. Using the browser though, I realized no assets have been built.

I won’t dig into that issue right now, as it would include setting up node-js properly in docker.

Perhaps you should switch to beardedegale/alpine-phoenix-builder as a base image, it comes with everything included…


PS: I also added a .dockerignore-file with the following content:

Dockerfile
deps
_build
3 Likes