Created
March 14, 2023 09:43
-
-
Save tomw1808/bd160398ed26a5b3334a98ed1c336a5f to your computer and use it in GitHub Desktop.
Working Blockscout 5.1.1 Dockerfile Apple Silicon M2 Elixier 1.14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM elixir:1.14.3 AS builder | |
# RUN apt-get update && apt-get install -y gmp-dev automake libtool inotify-tools autoconf python3 file qemu-x86_64 | |
# Update default packages | |
RUN apt-get update | |
# Get Ubuntu packages | |
RUN apt-get install -y \ | |
build-essential \ | |
curl \ | |
python3 git libtool automake cargo | |
# COPY docker/install-elixir.sh ./ | |
# RUN chmod a+x install-elixir.sh && sh install-elixir.sh | |
WORKDIR /app | |
# Get Rust | |
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y | |
ENV PATH="/root/.cargo/bin:${PATH}" | |
ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc \ | |
GLIBC_VERSION=2.30-r0 \ | |
PORT=4000 \ | |
MIX_ENV="prod" \ | |
SECRET_KEY_BASE="RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5" \ | |
PATH="$HOME/.cargo/bin:${PATH}" \ | |
RUSTFLAGS="-C target-feature=-crt-static" | |
ARG CACHE_EXCHANGE_RATES_PERIOD | |
ARG DISABLE_READ_API | |
ARG DISABLE_WEBAPP | |
ARG DISABLE_WRITE_API | |
ARG CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER | |
ARG WOBSERVER_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 | |
# 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 local.hex --force | |
RUN mix do deps.get, local.rebar --force, deps.compile | |
RUN curl -s https://deb.nodesource.com/setup_16.x | bash | |
RUN apt install nodejs -y | |
ADD . . | |
# COPY . . | |
# Run forderground build and phoenix digest | |
RUN mix compile && 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 | |
RUN mix phx.digest | |
RUN mkdir -p /opt/release \ | |
&& mix release blockscout \ | |
&& mv _build/${MIX_ENV}/rel/blockscout /opt/release | |
############################################################## | |
FROM elixir:1.14.3-slim | |
RUN apt-get update && apt-get install -y jq | |
WORKDIR /app | |
COPY --from=builder /opt/release/blockscout . | |
COPY --from=builder /app/apps/explorer/node_modules ./node_modules | |
COPY --from=builder /app/config/config_helper.exs ./config/config_helper.exs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment