-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docs and dockerfile for portable blockscout rapid development
- Loading branch information
Showing
3 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Raw version representing v5.3.1-beta | ||
ARG BLOCKSCOUT_VERSION=5.3.1 | ||
|
||
# | ||
# The backend-builder uses the official exlixir docker image that contains | ||
# Elixir, Erlang, compatiable OTP version, and mix. | ||
# | ||
FROM elixir:1.14-otp-25 as backend-builder | ||
ARG BLOCKSCOUT_VERSION | ||
|
||
WORKDIR /src | ||
|
||
# All elixir dependencies are already installed | ||
# We only need git to clone and apply patches | ||
RUN apt-get update \ | ||
&& apt-get install -y git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# COPY patches first, since we want to apply after clone, but before compiling | ||
# This does force a re-clone if there are patch changes, but also reduces our layers. | ||
# | ||
COPY ./patches /src/patches | ||
|
||
# The order of the below steps must be kept the same | ||
# | ||
# Clone the blockscout repository | ||
RUN git clone --depth 1 --branch v${BLOCKSCOUT_VERSION}-beta https://github.com/blockscout/blockscout.git | ||
WORKDIR blockscout | ||
# apply patches | ||
RUN git apply /src/patches/*.patch | ||
RUN mix local.hex --force | ||
RUN mix local.rebar --force | ||
# install prod dependencies | ||
RUN mix deps.get | ||
# compile minimal production optimized version of application | ||
RUN mix compile | ||
# The order of the above steps must be kept the same | ||
# | ||
|
||
# | ||
# The frontend-builder copies builds the block_scout_web frontend and installs solc for the explorer using npm. | ||
# | ||
|
||
WORKDIR /src | ||
|
||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | ||
apt-get install -y nodejs \ | ||
build-essential && \ | ||
node --version && \ | ||
npm --version | ||
# Build the user interface (block_scout_web/assets) and then install the solc npm package (explorer) | ||
RUN cd blockscout/apps/block_scout_web/assets \ | ||
&& npm install \ | ||
&& NODE_ENV=prod npm run deploy \ | ||
&& cd ../../explorer \ | ||
&& npm install | ||
|
||
# | ||
# The runner uses debian 11 (bullseye), which matches the OS used in previous steps. | ||
# | ||
# For elixir applications, we must ensure the locale is UTF-8. | ||
# | ||
# In addition, we also ensure ca-certificates are up to date. | ||
# | ||
# FROM debian:11 as runner | ||
# ARG BLOCKSCOUT_VERSION | ||
|
||
# Install locale, update ca certs, install node for contract verification | ||
RUN apt-get update \ | ||
&& apt-get install -y locales ca-certificates nodejs \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ | ||
&& locale-gen \ | ||
&& update-ca-certificates | ||
|
||
# Ensure utf8 locale is used | ||
ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 | ||
|
||
WORKDIR /src/blockscout | ||
|
||
# | ||
CMD tail -f /dev/null |