I’m trying to create a docker container for a demo project. So I followed this steps
FROM bitwalker/alpine-elixir:1.7 as build
COPY . .
RUN export MIX_ENV=prod && \
rm -Rf _build && \
mix deps.get && \
mix release
But after running this
docker build -t elixir-docker-guide .
I’m getting this error
Sending build context to Docker daemon 16.84MB
Step 1/3 : FROM bitwalker/alpine-elixir:1.7 as build
1.7: Pulling from bitwalker/alpine-elixir
8e3ba11ec2a2: Pull complete
462178e4d842: Pull complete
9e748cddddbb: Pull complete
a6febdbdc7a2: Pull complete
Digest: sha256:65f21812a0a9bb138ad210fba9e0eb38ae03c0a56c5b29d43fbd3eedf7bcb3ef
Status: Downloaded newer image for bitwalker/alpine-elixir:1.7
---> 1242a38c1217
Step 2/3 : COPY . .
---> 1a0d8a867026
Step 3/3 : RUN export MIX_ENV=prod && rm -Rf _build && mix deps.get && mix release
---> Running in 5379dc4c1305
** (RuntimeError) environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
(stdlib) erl_eval.erl:677: :erl_eval.do_apply/6
(stdlib) erl_eval.erl:446: :erl_eval.expr/5
(stdlib) erl_eval.erl:126: :erl_eval.exprs/5
(elixir) lib/code.ex:232: Code.eval_string/3
(mix) lib/mix/config.ex:187: anonymous fn/2 in Mix.Config.__import__!/2
(elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
(mix) lib/mix/config.ex:186: Mix.Config.__import__!/2
The command '/bin/sh -c export MIX_ENV=prod && rm -Rf _build && mix deps.get && mix release' returned a non-zero code: 1
How do I fix this?
and also can I use some particular files instead of copy . . ?