try to build a Dockerfile for textdb
peponi opened this issue · 0 comments
peponi commented
Hi
I have tried to quickly setup a Dockerfile for your project (to test textdb)
but I got held up because of this error
Generated textdb app
12:22:27.010 [error] GenServer #PID<0.3900.0> terminating
** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
(db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
(connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Textdb.Repo couldn't be created: killed
did I have to run a PostgresDB on the side?
if I try to install only the NPM dependecies, I got:
ERROR in ./js/app.js
Module not found: Error: Can't resolve 'phoenix' in '/textdb/assets/js'
@ ./js/app.js 16:0-33 19:41-47
@ multi ./js/app.js
ERROR in ./js/app.js
Module not found: Error: Can't resolve 'phoenix_html' in '/textdb/assets/js'
@ ./js/app.js 14:0-22
@ multi ./js/app.js
ERROR in ./js/app.js
Module not found: Error: Can't resolve 'phoenix_live_view' in '/textdb/assets/js'
@ ./js/app.js 17:0-43 19:21-31
@ multi ./js/app.js
looks like, I need to compile the elixir stuff first
Dockerfile
FROM elixir:1.10.4
#FROM node:12
ARG PORT=3000
ENV PORT=$PORT
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get autoremove -y \
&& git clone https://github.com/bontaq/textdb.git \
&& cd textdb \
&& mix local.hex --force \
&& mix local.rebar --force \
&& mix deps.get \
&& mix ecto.setup
# && cd assets \
# && npm i \
# && npm run deploy \
# && ls -la
WORKDIR /textdb
EXPOSE $PORT
CMD mix phx.server
HEALTHCHECK CMD curl --fail http://127.0.0.1:$PORT/ || exit 1
build that file
docker build --force-rm -t textdb:latest .