chore: refactor Dockerfile (#11130)

* chore: refactor dockerfile

* chore: update eth-sepolia ci
pull/10624/merge
Kirill Fedoseev 1 day ago committed by GitHub
parent bb5f6acd7b
commit 673f1718f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 34
      .github/workflows/pre-release-arbitrum.yml
  2. 34
      .github/workflows/publish-docker-image-for-arbitrum.yml
  3. 34
      .github/workflows/publish-docker-image-for-eth-sepolia.yml
  4. 7
      docker-compose/docker-compose.yml
  5. 3
      docker-compose/envs/common-blockscout.env
  6. 105
      docker/Dockerfile
  7. 130
      docker/oldUI.Dockerfile

@ -41,13 +41,6 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
DISABLE_WEBAPP=false
API_V1_READ_METHODS_DISABLED=false
API_V1_WRITE_METHODS_DISABLED=false
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
ADMIN_PANEL_ENABLED=false
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -65,11 +58,6 @@ jobs:
linux/arm64/v8
build-args: |
DISABLE_API=true
DISABLE_WEBAPP=true
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
ADMIN_PANEL_ENABLED=false
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -87,11 +75,6 @@ jobs:
linux/arm64/v8
build-args: |
DISABLE_INDEXER=true
DISABLE_WEBAPP=true
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
ADMIN_PANEL_ENABLED=false
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -108,13 +91,6 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
DISABLE_WEBAPP=false
API_V1_READ_METHODS_DISABLED=false
API_V1_WRITE_METHODS_DISABLED=false
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -133,11 +109,6 @@ jobs:
linux/arm64/v8
build-args: |
DISABLE_API=true
DISABLE_WEBAPP=true
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
ADMIN_PANEL_ENABLED=false
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -156,11 +127,6 @@ jobs:
linux/arm64/v8
build-args: |
DISABLE_INDEXER=true
DISABLE_WEBAPP=true
CACHE_EXCHANGE_RATES_PERIOD=
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-alpha.${{ inputs.number }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum

@ -36,13 +36,6 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
API_V1_READ_METHODS_DISABLED=false
DISABLE_WEBAPP=false
API_V1_WRITE_METHODS_DISABLED=false
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -59,12 +52,7 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_WEBAPP=true
DISABLE_API=true
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -81,12 +69,7 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_WEBAPP=true
DISABLE_INDEXER=true
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -103,13 +86,6 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
API_V1_READ_METHODS_DISABLED=false
DISABLE_WEBAPP=false
API_V1_WRITE_METHODS_DISABLED=false
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -127,12 +103,7 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_WEBAPP=true
DISABLE_API=true
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum
@ -150,12 +121,7 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_WEBAPP=true
DISABLE_INDEXER=true
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=arbitrum

@ -36,13 +36,6 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
API_V1_READ_METHODS_DISABLED=false
DISABLE_WEBAPP=false
API_V1_WRITE_METHODS_DISABLED=false
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=ethereum
@ -59,12 +52,7 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_WEBAPP=true
DISABLE_API=true
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=ethereum
@ -81,12 +69,7 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_WEBAPP=true
DISABLE_INDEXER=true
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=ethereum
@ -103,13 +86,6 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
API_V1_READ_METHODS_DISABLED=false
DISABLE_WEBAPP=false
API_V1_WRITE_METHODS_DISABLED=false
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}-shrink-internal-txs
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=ethereum
@ -127,12 +103,7 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_WEBAPP=true
DISABLE_API=true
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}-shrink-internal-txs
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=ethereum
@ -150,12 +121,7 @@ jobs:
linux/amd64
linux/arm64/v8
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_WEBAPP=true
DISABLE_INDEXER=true
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED=
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
BLOCKSCOUT_VERSION=v${{ env.RELEASE_VERSION }}-beta.+commit.${{ env.SHORT_SHA }}-shrink-internal-txs
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
CHAIN_TYPE=ethereum

@ -30,13 +30,6 @@ services:
context: ..
dockerfile: ./docker/Dockerfile
args:
CACHE_EXCHANGE_RATES_PERIOD: ""
API_V1_READ_METHODS_DISABLED: "false"
DISABLE_WEBAPP: "false"
API_V1_WRITE_METHODS_DISABLED: "false"
CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED: ""
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL: ""
ADMIN_PANEL_ENABLED: ""
RELEASE_VERSION: 6.9.2
links:
- db:database

@ -138,7 +138,8 @@ CONTRACT_MAX_STRING_LENGTH_WITHOUT_TRIMMING=2040
# CONTRACT_AUDIT_REPORTS_AIRTABLE_API_KEY=
# CONTRACT_CERTIFIED_LIST=
UNCLES_IN_AVERAGE_BLOCK_TIME=false
DISABLE_WEBAPP=false
DISABLE_WEBAPP=true
ADMIN_PANEL_ENABLED=false
API_V2_ENABLED=true
API_V1_READ_METHODS_DISABLED=false
API_V1_WRITE_METHODS_DISABLED=false

@ -1,26 +1,39 @@
FROM hexpm/elixir:1.17.3-erlang-27.1-alpine-3.20.3 AS builder
FROM hexpm/elixir:1.17.3-erlang-27.1-alpine-3.20.3 AS builder-deps
WORKDIR /app
ENV MIX_ENV="prod"
RUN apk --no-cache --update add \
alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file gcompat libstdc++ curl ca-certificates git make
# Cache elixir deps
COPY mix.exs mix.lock ./
COPY apps/block_scout_web/mix.exs ./apps/block_scout_web/
COPY apps/explorer/mix.exs ./apps/explorer/
COPY apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/
COPY apps/indexer/mix.exs ./apps/indexer/
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file gcompat
ENV MIX_ENV="prod"
ENV MIX_HOME=/opt/mix
RUN mix local.hex --force
RUN mix do deps.get, local.rebar --force, deps.compile --skip-umbrella-children
RUN set -ex && \
apk --update add libstdc++ curl ca-certificates gcompat
COPY config ./config
COPY rel ./rel
COPY apps ./apps
ARG CACHE_EXCHANGE_RATES_PERIOD
##############################################################
FROM builder-deps AS builder
ENV DISABLE_WEBAPP=true
ENV ADMIN_PANEL_ENABLED=false
ARG DISABLE_INDEXER
ENV DISABLE_INDEXER=${DISABLE_INDEXER}
ARG DISABLE_API
ENV DISABLE_API=${DISABLE_API}
ARG API_V1_READ_METHODS_DISABLED
ARG DISABLE_WEBAPP
ENV API_V1_READ_METHODS_DISABLED=${API_V1_READ_METHODS_DISABLED}
ARG API_V1_WRITE_METHODS_DISABLED
ARG CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED
ARG ADMIN_PANEL_ENABLED
ARG CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL
ARG SESSION_COOKIE_DOMAIN
ARG MIXPANEL_TOKEN
ARG MIXPANEL_URL
ARG AMPLITUDE_API_KEY
ARG AMPLITUDE_URL
ENV API_V1_WRITE_METHODS_DISABLED=${API_V1_WRITE_METHODS_DISABLED}
ARG CHAIN_TYPE
ENV CHAIN_TYPE=${CHAIN_TYPE}
ARG BRIDGED_TOKENS_ENABLED
@ -32,44 +45,18 @@ ENV SHRINK_INTERNAL_TRANSACTIONS_ENABLED=${SHRINK_INTERNAL_TRANSACTIONS_ENABLED}
ARG API_GRAPHQL_MAX_COMPLEXITY
ENV API_GRAPHQL_MAX_COMPLEXITY=${API_GRAPHQL_MAX_COMPLEXITY}
# 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/
ENV MIX_HOME=/opt/mix
RUN mix local.hex --force
RUN mix do deps.get, local.rebar --force, deps.compile
ADD apps ./apps
ADD config ./config
ADD rel ./rel
ADD *.exs ./
# Run backend compilation
RUN mix compile
RUN apk add --update git make
RUN mkdir -p /opt/release \
&& mix release blockscout \
&& mv _build/${MIX_ENV}/rel/blockscout /opt/release
RUN mkdir -p /opt/release && \
mix release blockscout && \
mv _build/${MIX_ENV}/rel/blockscout /opt/release
##############################################################
FROM hexpm/elixir:1.17.3-erlang-27.1-alpine-3.20.3
ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}
ARG CHAIN_TYPE
ENV CHAIN_TYPE=${CHAIN_TYPE}
ARG BRIDGED_TOKENS_ENABLED
ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED}
ARG SHRINK_INTERNAL_TRANSACTIONS_ENABLED
ENV SHRINK_INTERNAL_TRANSACTIONS_ENABLED=${SHRINK_INTERNAL_TRANSACTIONS_ENABLED}
ARG BLOCKSCOUT_VERSION
ENV BLOCKSCOUT_VERSION=${BLOCKSCOUT_VERSION}
WORKDIR /app
ARG BLOCKSCOUT_USER=blockscout
ARG BLOCKSCOUT_GROUP=blockscout
ARG BLOCKSCOUT_UID=10001
@ -79,7 +66,31 @@ RUN apk --no-cache --update add jq curl && \
addgroup --system --gid ${BLOCKSCOUT_GID} ${BLOCKSCOUT_GROUP} && \
adduser --system --uid ${BLOCKSCOUT_UID} --ingroup ${BLOCKSCOUT_GROUP} --disabled-password ${BLOCKSCOUT_USER}
WORKDIR /app
ENV DISABLE_WEBAPP=true
ENV ADMIN_PANEL_ENABLED=false
ARG DISABLE_INDEXER
ENV DISABLE_INDEXER=${DISABLE_INDEXER}
ARG DISABLE_API
ENV DISABLE_API=${DISABLE_API}
ARG API_V1_READ_METHODS_DISABLED
ENV API_V1_READ_METHODS_DISABLED=${API_V1_READ_METHODS_DISABLED}
ARG API_V1_WRITE_METHODS_DISABLED
ENV API_V1_WRITE_METHODS_DISABLED=${API_V1_WRITE_METHODS_DISABLED}
ARG CHAIN_TYPE
ENV CHAIN_TYPE=${CHAIN_TYPE}
ARG BRIDGED_TOKENS_ENABLED
ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED}
ARG MUD_INDEXER_ENABLED
ENV MUD_INDEXER_ENABLED=${MUD_INDEXER_ENABLED}
ARG SHRINK_INTERNAL_TRANSACTIONS_ENABLED
ENV SHRINK_INTERNAL_TRANSACTIONS_ENABLED=${SHRINK_INTERNAL_TRANSACTIONS_ENABLED}
ARG API_GRAPHQL_MAX_COMPLEXITY
ENV API_GRAPHQL_MAX_COMPLEXITY=${API_GRAPHQL_MAX_COMPLEXITY}
ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}
ARG BLOCKSCOUT_VERSION
ENV BLOCKSCOUT_VERSION=${BLOCKSCOUT_VERSION}
COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /opt/release/blockscout .
COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/config/config_helper.exs ./config/config_helper.exs

@ -1,87 +1,78 @@
FROM hexpm/elixir:1.17.3-erlang-27.1-alpine-3.20.3 AS builder
FROM hexpm/elixir:1.17.3-erlang-27.1-alpine-3.20.3 AS builder-deps
WORKDIR /app
ENV MIX_ENV="prod"
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file gcompat
RUN set -ex && \
apk --update add libstdc++ curl ca-certificates gcompat
ARG CACHE_EXCHANGE_RATES_PERIOD
ARG API_V1_READ_METHODS_DISABLED
ARG DISABLE_WEBAPP
ARG API_V1_WRITE_METHODS_DISABLED
ARG CACHE_TOTAL_GAS_USAGE_COUNTER_ENABLED
ARG ADMIN_PANEL_ENABLED
ARG CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL
ARG SESSION_COOKIE_DOMAIN
ARG MIXPANEL_TOKEN
ARG MIXPANEL_URL
ARG AMPLITUDE_API_KEY
ARG AMPLITUDE_URL
ARG CHAIN_TYPE
ENV CHAIN_TYPE=${CHAIN_TYPE}
ARG BRIDGED_TOKENS_ENABLED
ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED}
ARG MUD_INDEXER_ENABLED
ENV MUD_INDEXER_ENABLED=${MUD_INDEXER_ENABLED}
ARG SHRINK_INTERNAL_TRANSACTIONS_ENABLED
ENV SHRINK_INTERNAL_TRANSACTIONS_ENABLED=${SHRINK_INTERNAL_TRANSACTIONS_ENABLED}
RUN apk --no-cache --update add \
alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file gcompat libstdc++ curl ca-certificates git make
# 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/
COPY mix.exs mix.lock ./
COPY apps/block_scout_web/mix.exs ./apps/block_scout_web/
COPY apps/explorer/mix.exs ./apps/explorer/
COPY apps/ethereum_jsonrpc/mix.exs ./apps/ethereum_jsonrpc/
COPY apps/indexer/mix.exs ./apps/indexer/
ENV MIX_ENV="prod"
ENV MIX_HOME=/opt/mix
RUN mix local.hex --force
RUN mix do deps.get, local.rebar --force, deps.compile
RUN mix do deps.get, local.rebar --force, deps.compile --skip-umbrella-children
ADD apps ./apps
ADD config ./config
ADD rel ./rel
ADD *.exs ./
COPY config ./config
COPY rel ./rel
COPY apps ./apps
RUN apk add --update nodejs npm
##############################################################
FROM builder-deps AS builder-ui
# Run backend compilation and install latest npm
RUN mix compile && npm install npm@latest
RUN apk --no-cache --update add nodejs npm && \
npm install npm@latest
# Add blockscout npm deps
RUN cd apps/block_scout_web/assets/ && \
npm install && \
npm run deploy && \
cd /app/apps/explorer/ && \
npm install && \
apk update && \
apk del --force-broken-world alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3
RUN apk add --update git make
npm install
RUN mix phx.digest
RUN mkdir -p /opt/release \
&& mix release blockscout \
&& mv _build/${MIX_ENV}/rel/blockscout /opt/release
##############################################################
FROM hexpm/elixir:1.17.3-erlang-27.1-alpine-3.20.3
FROM builder-ui AS builder
ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}
ENV DISABLE_WEBAPP=false
ARG ADMIN_PANEL_ENABLED
ENV ADMIN_PANEL_ENABLED=${ADMIN_PANEL_ENABLED}
ARG DISABLE_INDEXER
ENV DISABLE_INDEXER=${DISABLE_INDEXER}
ARG DISABLE_API
ENV DISABLE_API=${DISABLE_API}
ARG API_V1_READ_METHODS_DISABLED
ENV API_V1_READ_METHODS_DISABLED=${API_V1_READ_METHODS_DISABLED}
ARG API_V1_WRITE_METHODS_DISABLED
ENV API_V1_WRITE_METHODS_DISABLED=${API_V1_WRITE_METHODS_DISABLED}
ARG CHAIN_TYPE
ENV CHAIN_TYPE=${CHAIN_TYPE}
ARG BRIDGED_TOKENS_ENABLED
ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED}
ARG MUD_INDEXER_ENABLED
ENV MUD_INDEXER_ENABLED=${MUD_INDEXER_ENABLED}
ARG SHRINK_INTERNAL_TRANSACTIONS_ENABLED
ENV SHRINK_INTERNAL_TRANSACTIONS_ENABLED=${SHRINK_INTERNAL_TRANSACTIONS_ENABLED}
ARG BLOCKSCOUT_VERSION
ENV BLOCKSCOUT_VERSION=${BLOCKSCOUT_VERSION}
ARG API_GRAPHQL_MAX_COMPLEXITY
ENV API_GRAPHQL_MAX_COMPLEXITY=${API_GRAPHQL_MAX_COMPLEXITY}
# Run backend compilation
RUN mix compile
RUN mkdir -p /opt/release && \
mix release blockscout && \
mv _build/${MIX_ENV}/rel/blockscout /opt/release
##############################################################
FROM hexpm/elixir:1.17.3-erlang-27.1-alpine-3.20.3
WORKDIR /app
ARG BLOCKSCOUT_USER=blockscout
ARG BLOCKSCOUT_GROUP=blockscout
ARG BLOCKSCOUT_UID=10001
@ -91,7 +82,32 @@ RUN apk --no-cache --update add jq curl && \
addgroup --system --gid ${BLOCKSCOUT_GID} ${BLOCKSCOUT_GROUP} && \
adduser --system --uid ${BLOCKSCOUT_UID} --ingroup ${BLOCKSCOUT_GROUP} --disabled-password ${BLOCKSCOUT_USER}
WORKDIR /app
ENV DISABLE_WEBAPP=false
ARG ADMIN_PANEL_ENABLED
ENV ADMIN_PANEL_ENABLED=${ADMIN_PANEL_ENABLED}
ARG DISABLE_INDEXER
ENV DISABLE_INDEXER=${DISABLE_INDEXER}
ARG DISABLE_API
ENV DISABLE_API=${DISABLE_API}
ARG API_V1_READ_METHODS_DISABLED
ENV API_V1_READ_METHODS_DISABLED=${API_V1_READ_METHODS_DISABLED}
ARG API_V1_WRITE_METHODS_DISABLED
ENV API_V1_WRITE_METHODS_DISABLED=${API_V1_WRITE_METHODS_DISABLED}
ARG CHAIN_TYPE
ENV CHAIN_TYPE=${CHAIN_TYPE}
ARG BRIDGED_TOKENS_ENABLED
ENV BRIDGED_TOKENS_ENABLED=${BRIDGED_TOKENS_ENABLED}
ARG MUD_INDEXER_ENABLED
ENV MUD_INDEXER_ENABLED=${MUD_INDEXER_ENABLED}
ARG SHRINK_INTERNAL_TRANSACTIONS_ENABLED
ENV SHRINK_INTERNAL_TRANSACTIONS_ENABLED=${SHRINK_INTERNAL_TRANSACTIONS_ENABLED}
ARG API_GRAPHQL_MAX_COMPLEXITY
ENV API_GRAPHQL_MAX_COMPLEXITY=${API_GRAPHQL_MAX_COMPLEXITY}
ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}
ARG BLOCKSCOUT_VERSION
ENV BLOCKSCOUT_VERSION=${BLOCKSCOUT_VERSION}
COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /opt/release/blockscout .
COPY --from=builder --chown=${BLOCKSCOUT_USER}:${BLOCKSCOUT_GROUP} /app/apps/explorer/node_modules ./node_modules

Loading…
Cancel
Save