Merge pull request #8040 from blockscout/vb-resolve-docker-image-for-m2-m1

Resolve issue with Docker image for Mac M1/M2
pull/8047/head
Victor Baranov 1 year ago committed by GitHub
commit 5ede3b5d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .circleci/config.yml
  2. 2
      .github/workflows/config.yml
  3. 2
      CHANGELOG.md
  4. 5
      apps/indexer/lib/indexer/transform/blocks.ex
  5. 4
      apps/indexer/mix.exs
  6. 3
      cspell.json
  7. 2
      docker-compose/docker-compose-no-build-erigon.yml
  8. 2
      docker-compose/docker-compose-no-build-frontend.yml
  9. 2
      docker-compose/docker-compose-no-build-ganache.yml
  10. 2
      docker-compose/docker-compose-no-build-geth-clique-consensus.yml
  11. 2
      docker-compose/docker-compose-no-build-geth.yml
  12. 2
      docker-compose/docker-compose-no-build-hardhat-network.yml
  13. 2
      docker-compose/docker-compose-no-build-nethermind.yml
  14. 2
      docker-compose/docker-compose-no-build-no-db-container.yml
  15. 2
      docker-compose/docker-compose-no-rust-services.yml
  16. 2
      docker-compose/docker-compose.yml
  17. 1
      docker-compose/services/docker-compose-frontend.yml
  18. 1
      docker-compose/services/docker-compose-sig-provider.yml
  19. 1
      docker-compose/services/docker-compose-smart-contract-verifier.yml
  20. 1
      docker-compose/services/docker-compose-stats.yml
  21. 1
      docker-compose/services/docker-compose-visualizer.yml
  22. 30
      docker/Dockerfile
  23. 2
      mix.lock

@ -75,10 +75,9 @@ jobs:
- run: mix compile
# Ensure NIF is compiled for libsecp256k1
- run:
command: make
working_directory: "deps/libsecp256k1"
working_directory: "deps/ex_secp256k1"
# `deps` needs to be cached with `_build` because `_build` will symlink into `deps`

@ -58,8 +58,6 @@ jobs:
mix local.rebar --force
mix deps.get
mix deps.compile
cd deps/libsecp256k1
make
- name: Restore Explorer NPM Cache
uses: actions/cache@v2

@ -6,6 +6,8 @@
### Fixes
- [#8040](https://github.com/blockscout/blockscout/pull/8040) - Resolve issue with Docker image for Mac M1/M2
### Chore
<details>

@ -3,6 +3,8 @@ defmodule Indexer.Transform.Blocks do
Protocol for transforming blocks.
"""
alias ExSecp256k1
@type block :: map()
@doc """
@ -91,8 +93,7 @@ defmodule Indexer.Transform.Blocks do
# First byte represents compression which can be ignored
# Private key is the last 64 bytes
{:ok, <<_compression::bytes-size(1), private_key::binary>>} =
:libsecp256k1.ecdsa_recover_compact(signature_hash, r <> s, :uncompressed, v)
{:ok, <<_compression::bytes-size(1), private_key::binary>>} = ExSecp256k1.recover(signature_hash, r, s, v)
# Public key comes from the last 20 bytes
<<_::bytes-size(12), public_key::binary>> = ExKeccak.hash_256(private_key)

@ -45,8 +45,8 @@ defmodule Indexer.MixProject do
{:ex_rlp, "~> 0.6.0"},
# Importing to database
{:explorer, in_umbrella: true},
# libsecp2561k1 crypto functions
{:libsecp256k1, "~> 0.1.10"},
# ex_secp256k1 crypto functions
{:ex_secp256k1, "~> 0.7.0"},
# Log errors and application output to separate files
{:logger_file_backend, "~> 0.0.10"},
# Mocking `EthereumJSONRPC.Transport`, so we avoid hitting real chains for local testing

@ -518,7 +518,8 @@
"zkbob",
"erts",
"Asfpp",
"Nerg"
"Nerg",
"secp"
],
"enableFiletypes": [
"dotenv",

@ -23,7 +23,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -23,7 +23,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -23,7 +23,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -23,7 +23,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -23,7 +23,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -23,7 +23,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -23,7 +23,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -15,7 +15,7 @@ services:
restart: always
stop_grace_period: 5m
container_name: 'blockscout'
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -33,7 +33,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -34,7 +34,7 @@ services:
container_name: 'blockscout'
links:
- db:database
command: bash -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
command: sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:

@ -4,6 +4,7 @@ services:
frontend:
image: ghcr.io/blockscout/frontend:${FRONTEND_DOCKER_TAG:-latest}
pull_policy: always
platform: linux/amd64
restart: always
container_name: 'frontend'
env_file:

@ -4,6 +4,7 @@ services:
sig-provider:
image: ghcr.io/blockscout/sig-provider:${SIG_PROVIDER_DOCKER_TAG:-latest}
pull_policy: always
platform: linux/amd64
restart: always
container_name: 'sig-provider'
ports:

@ -4,6 +4,7 @@ services:
smart-contract-verifier:
image: ghcr.io/blockscout/smart-contract-verifier:${SMART_CONTRACT_VERIFIER_DOCKER_TAG:-latest}
pull_policy: always
platform: linux/amd64
restart: always
container_name: 'smart-contract-verifier'
env_file:

@ -18,6 +18,7 @@ services:
- stats-db
image: ghcr.io/blockscout/stats:${STATS_DOCKER_TAG:-latest}
pull_policy: always
platform: linux/amd64
restart: always
container_name: 'stats'
extra_hosts:

@ -4,6 +4,7 @@ services:
visualizer:
image: ghcr.io/blockscout/visualizer:${VISUALIZER_DOCKER_TAG:-latest}
pull_policy: always
platform: linux/amd64
restart: always
container_name: 'visualizer'
env_file:

@ -1,22 +1,14 @@
FROM bitwalker/alpine-elixir-phoenix:1.14 AS builder
FROM hexpm/elixir:1.14.5-erlang-25.3.2.4-alpine-3.18.2 AS builder
WORKDIR /app
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file qemu-x86_64
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file gcompat
ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc \
GLIBC_VERSION=2.34-r0 \
PORT=4000 \
ENV PORT=4000 \
MIX_ENV="prod" \
SECRET_KEY_BASE="RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5"
RUN set -ex && \
apk --update add libstdc++ curl ca-certificates && \
for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION}; \
do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \
apk add --allow-untrusted /tmp/*.apk && \
rm -v /tmp/*.apk && \
/usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib
RUN apk --update add libstdc++ curl ca-certificates gcompat
ARG CACHE_EXCHANGE_RATES_PERIOD
ARG API_V1_READ_METHODS_DISABLED
@ -38,11 +30,16 @@ ADD apps/explorer/mix.exs ./apps/explorer/
ADD apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/
ADD apps/indexer/mix.exs ./apps/indexer/
ENV MIX_HOME=/opt/mix
RUN mix local.hex --force
RUN mix do deps.get, local.rebar --force, deps.compile
ADD . .
ADD apps ./apps
ADD config ./config
ADD rel ./rel
ADD *.exs .
COPY . .
RUN apk add --update nodejs npm
# Run forderground build and phoenix digest
RUN mix compile && npm install npm@latest
@ -56,6 +53,9 @@ RUN cd apps/block_scout_web/assets/ && \
apk update && \
apk del --force-broken-world alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3
RUN apk add --update git make
RUN export "CFLAGS=-I/usr/local/include -L/usr/local/lib" && cd deps/ex_secp256k1 && mix deps.get && mix compile
RUN mix phx.digest
RUN mkdir -p /opt/release \
@ -63,7 +63,7 @@ RUN mkdir -p /opt/release \
&& mv _build/${MIX_ENV}/rel/blockscout /opt/release
##############################################################
FROM bitwalker/alpine-elixir-phoenix:1.14
FROM hexpm/elixir:1.14.5-erlang-25.3.2.4-alpine-3.18.2
ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}

@ -52,6 +52,7 @@
"ex_keccak": {:hex, :ex_keccak, "0.7.1", "0169f4b0c5073c5df61581d6282b12f1a1b764dcfcda4eeb1c819b5194c9ced0", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6.1", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "c18c19f66b6545b4b46b0c71c0cc0079de84e30b26365a92961e91697e8724ed"},
"ex_machina": {:hex, :ex_machina, "2.7.0", "b792cc3127fd0680fecdb6299235b4727a4944a09ff0fa904cc639272cd92dc7", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}], "hexpm", "419aa7a39bde11894c87a615c4ecaa52d8f107bbdd81d810465186f783245bf8"},
"ex_rlp": {:hex, :ex_rlp, "0.6.0", "985391d2356a7cb8712a4a9a2deb93f19f2fbca0323f5c1203fcaf64d077e31e", [:mix], [], "hexpm", "7135db93b861d9e76821039b60b00a6a22d2c4e751bf8c444bffe7a042f1abaf"},
"ex_secp256k1": {:hex, :ex_secp256k1, "0.7.0", "fa555152e8680c1e2df09ccc2884eccd25d8bc328c630b0b8952abe3745edc8f", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "2a8754c7b3d83bbcab4a188ed033254ca5c6ac252188ced0d382ca343096bf73"},
"ex_utils": {:hex, :ex_utils, "0.1.7", "2c133e0bcdc49a858cf8dacf893308ebc05bc5fba501dc3d2935e65365ec0bf3", [:mix], [], "hexpm", "66d4fe75285948f2d1e69c2a5ddd651c398c813574f8d36a9eef11dc20356ef6"},
"exactor": {:hex, :exactor, "2.2.4", "5efb4ddeb2c48d9a1d7c9b465a6fffdd82300eb9618ece5d34c3334d5d7245b1", [:mix], [], "hexpm", "1222419f706e01bfa1095aec9acf6421367dcfab798a6f67c54cf784733cd6b5"},
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm", "32e95820a97cffea67830e91514a2ad53b888850442d6d395f53a1ac60c82e07"},
@ -73,7 +74,6 @@
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm", "fc3499fed7a726995aa659143a248534adc754ebd16ccd437cd93b649a95091f"},
"junit_formatter": {:hex, :junit_formatter, "3.3.1", "c729befb848f1b9571f317d2fefa648e9d4869befc4b2980daca7c1edc468e40", [:mix], [], "hexpm", "761fc5be4b4c15d8ba91a6dafde0b2c2ae6db9da7b8832a55b5a1deb524da72b"},
"libsecp256k1": {:hex, :libsecp256k1, "0.1.10", "d27495e2b9851c7765129b76c53b60f5e275bd6ff68292c50536bf6b8d091a4d", [:make, :mix], [{:mix_erlang_tasks, "0.1.0", [hex: :mix_erlang_tasks, repo: "hexpm", optional: false]}], "hexpm", "09ea06239938571124f7f5a27bc9ac45dfb1cfc2df40d46ee9b59c3d51366652"},
"logger_file_backend": {:hex, :logger_file_backend, "0.0.13", "df07b14970e9ac1f57362985d76e6f24e3e1ab05c248055b7d223976881977c2", [:mix], [], "hexpm", "71a453a7e6e899ae4549fb147b1c6621f4233f8f48f58ca10a64ec67b6c50018"},
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},

Loading…
Cancel
Save