Add build-time envs to Dockerfile args

pull/5713/head
Qwerty5Uiop 2 years ago
parent dbff3dbc8d
commit c9bb71565a
  1. 16
      .github/workflows/publish-docker-image.yml
  2. 44
      config/runtime.exs
  3. 9
      docker-compose/docker-compose.yml
  4. 10
      docker/Dockerfile

@ -42,4 +42,18 @@ jobs:
images: blockscout/blockscout
- name: Build & Push Docker image
run: docker buildx build -t blockscout/blockscout:latest -t blockscout/blockscout:${{ env.RELEASE_VERSION }} -f ./docker/Dockerfile --push --platform=linux/arm64,linux/amd64 .
run: |
docker buildx build \
-t blockscout/blockscout:latest \
-t blockscout/blockscout:${{ env.RELEASE_VERSION }} \
-f ./docker/Dockerfile \
--build-arg CACHE_EXCHANGE_RATES_PERIOD="" \
--build-arg DISABLE_READ_API="false" \
--build-arg API_PATH="/" \
--build-arg NETWORK_PATH="/" \
--build-arg DISABLE_WEBAPP="false" \
--build-arg DISABLE_WRITE_API="false" \
--build-arg CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER="" \
--build-arg WOBSERVER_ENABLED="false" \
--build-arg ADMIN_PANEL_ENABLED="" \
--push --platform=linux/arm64,linux/amd64 .

@ -51,7 +51,9 @@ if config_env() == :prod do
logo_footer: System.get_env("LOGO_FOOTER"),
logo_text: System.get_env("LOGO_TEXT"),
has_emission_funds: false,
show_maintenance_alert: System.get_env("SHOW_MAINTENANCE_ALERT", "false") == "true"
show_maintenance_alert: System.get_env("SHOW_MAINTENANCE_ALERT", "false") == "true",
enable_testnet_label: System.get_env("SHOW_TESTNET_LABEL", "false") == "true",
testnet_label_text: System.get_env("TESTNET_LABEL_TEXT", "Testnet")
config :block_scout_web,
link_to_other_explorers: System.get_env("LINK_TO_OTHER_EXPLORERS") == "true",
@ -371,7 +373,8 @@ if config_env() == :prod do
"ganache" => EthereumJSONRPC.Ganache,
"geth" => EthereumJSONRPC.Geth,
"parity" => EthereumJSONRPC.Parity,
"rsk" => EthereumJSONRPC.RSK
"rsk" => EthereumJSONRPC.RSK,
"erigon" => EthereumJSONRPC.Erigon
}
cond do
@ -399,7 +402,7 @@ if config_env() == :prod do
variant: variant_name_map[variant]
]
variant in ["besu", "parity", "rsk"] ->
variant in ["besu", "parity", "rsk", "erigon"] ->
config :explorer,
json_rpc_named_arguments: [
transport: EthereumJSONRPC.HTTP,
@ -720,5 +723,40 @@ if config_env() == :prod do
url: System.get_env("ETHEREUM_JSONRPC_WS_URL")
]
]
"erigon" ->
config :indexer,
block_interval: :timer.seconds(5),
json_rpc_named_arguments: [
transport:
if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http",
do: EthereumJSONRPC.HTTP,
else: EthereumJSONRPC.IPC
),
transport_options: [
http: EthereumJSONRPC.HTTP.HTTPoison,
url: System.get_env("ETHEREUM_JSONRPC_HTTP_URL"),
method_to_url: [
eth_getBalance: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"),
trace_block: System.get_env("ETHEREUM_JSONRPC_TRACE_URL"),
trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_TRACE_URL")
],
http_options: [
recv_timeout: :timer.minutes(10),
timeout: :timer.minutes(10),
hackney: [pool: :ethereum_jsonrpc]
]
],
variant: EthereumJSONRPC.Erigon
],
subscribe_named_arguments: [
transport:
System.get_env("ETHEREUM_JSONRPC_WS_URL") && System.get_env("ETHEREUM_JSONRPC_WS_URL") !== "" &&
EthereumJSONRPC.WebSocket,
transport_options: [
web_socket: EthereumJSONRPC.WebSocket.WebSocketClient,
url: System.get_env("ETHEREUM_JSONRPC_WS_URL")
]
]
end
end

@ -21,6 +21,15 @@ services:
dockerfile: ./docker/Dockerfile
args:
COIN: ""
CACHE_EXCHANGE_RATES_PERIOD: ""
DISABLE_READ_API: "false"
API_PATH: "/"
NETWORK_PATH: "/"
DISABLE_WEBAPP: "false"
DISABLE_WRITE_API: "false"
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER: ""
WOBSERVER_ENABLED: "false"
ADMIN_PANEL_ENABLED: ""
restart: always
container_name: 'blockscout'
links:

@ -23,6 +23,16 @@ ENV RUSTFLAGS="-C target-feature=-crt-static"
EXPOSE 4000
ARG CACHE_EXCHANGE_RATES_PERIOD
ARG DISABLE_READ_API
ARG API_PATH
ARG NETWORK_PATH
ARG DISABLE_WEBAPP
ARG DISABLE_WRITE_API
ARG CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER
ARG WOBSERVER_ENABLED
ARG ADMIN_PANEL_ENABLED
ENV PORT=4000 \
MIX_ENV="prod" \
SECRET_KEY_BASE="RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5"

Loading…
Cancel
Save