Added docker files

pull/993/head
Konstantin Zolotarev 6 years ago
parent 802cb2d838
commit c1d1385abb
  1. 5
      .dockerignore
  2. 38
      Dockerfile
  3. 4
      apps/explorer/config/dev.exs
  4. 2
      apps/indexer/config/dev.exs

@ -0,0 +1,5 @@
_build
deps
apps/block_scout_web/assets/node_modules
apps/explorer/node_modules
test

@ -0,0 +1,38 @@
FROM bitwalker/alpine-elixir-phoenix:latest
RUN apk --no-cache --update add automake libtool inotify-tools autoconf
EXPOSE 4000
ENV PORT=4000 \
MIX_ENV="prod" \
ETHEREUM_JSONRPC_VARIANT="ganache" \
ETHEREUM_JSONRPC_HTTP_URL="http://host.docker.internal:7545" \
ETHEREUM_JSONRPC_WEB_SOCKET_URL="ws://host.docker.internal:7545" \
POSTGRES_URL="host.docker.internal" \
DATABASE_URL="postgresql://postgres:@host.docker.internal:5432/explorer?ssl=false" \
SECRET_KEY_BASE="RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5"
# Cache elixir deps
ADD mix.exs mix.lock ./
ADD apps/block_scout_web/mix.exs ./apps/block_scout_web/
ADD apps/explorer/mix.exs ./apps/explorer/
ADD apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/
ADD apps/indexer/mix.exs ./apps/indexer/
RUN mix do deps.get, deps.compile
ADD . .
# Run forderground build and phoenix digest
RUN mix do compile, phx.digest
# Add blockscout npm deps
RUN cd apps/block_scout_web/assets/ && npm install && npm run deploy && cd -
RUN cd apps/explorer/ && npm install && cd -
RUN mix do ecto.drop --force, ecto.create, ecto.migrate
# USER default
CMD ["mix", "phx.server"]

@ -4,7 +4,7 @@ use Mix.Config
config :explorer, Explorer.Repo,
adapter: Ecto.Adapters.Postgres,
database: "explorer_dev",
hostname: "localhost",
hostname: System.get_env("POSTGRES_URL") || "localhost",
pool_size: 20,
pool_timeout: 60_000,
timeout: 80_000
@ -17,7 +17,7 @@ import_config "dev.secret.exs"
variant =
if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do
"parity"
"ganache"
else
System.get_env("ETHEREUM_JSONRPC_VARIANT")
|> String.split(".")

@ -11,7 +11,7 @@ config :logger, :indexer_token_balances,
variant =
if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do
"parity"
"ganache"
else
System.get_env("ETHEREUM_JSONRPC_VARIANT")
|> String.split(".")

Loading…
Cancel
Save