Skip to content

Commit

Permalink
Merge pull request #16 from oasysgames/build-v5.2.1-beta
Browse files Browse the repository at this point in the history
Fix container build workflow error in v5.2.1
  • Loading branch information
ironbeer authored Sep 23, 2023
2 parents 1eb5de1 + 8bb1b96 commit 75fdc66
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 24 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,20 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}
push: true
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=
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
ADMIN_PANEL_ENABLED=
RELEASE_VERSION=5.2.1
COIN=
DISABLE_READ_API=false
API_PATH=/
NETWORK_PATH=/
DISABLE_WRITE_API=false
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER=
SOCKET_ROOT=/
WOBSERVER_ENABLED=false
49 changes: 25 additions & 24 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
FROM bitwalker/alpine-elixir-phoenix:1.14 AS builder
FROM hexpm/elixir:1.14.5-erlang-25.3.2.4-ubuntu-jammy-20230126 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 apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y \
libgmp-dev automake autoconf libtool inotify-tools python3 \
file libstdc++6 ca-certificates curl git make nodejs npm

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
SECRET_KEY_BASE="RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5" \
ERL_FLAGS="+JPperf true"

ARG CACHE_EXCHANGE_RATES_PERIOD
ARG DISABLE_READ_API
Expand Down Expand Up @@ -47,11 +41,14 @@ 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 . .

COPY . .
ADD apps ./apps
ADD config ./config
ADD rel ./rel
ADD *.exs ./

RUN if [ "$COIN" != "" ]; then \
sed -i s/"POA"/"${COIN}"/g apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; \
Expand All @@ -61,17 +58,17 @@ RUN if [ "$COIN" != "" ]; then \
sed -i "/msgid \"ETH\"/{n;s/msgstr \"\"/msgstr \"${COIN}\"/g}" apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po; \
fi


# Run forderground build and phoenix digest
RUN mix compile && npm install npm@latest
RUN mix compile
RUN npm install -g n && n 18.18.0 && apt purge -y nodejs npm

# 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
npm install

RUN mix phx.digest

Expand All @@ -80,14 +77,18 @@ 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-ubuntu-jammy-20230126

ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}
ARG BLOCKSCOUT_VERSION
ENV BLOCKSCOUT_VERSION=${BLOCKSCOUT_VERSION}

RUN apk --no-cache --update add jq
RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y jq libgmp-dev && \
apt clean autoclean && \
apt autoremove -y && \
rm -rf /var/lib/{apt,dpkg,cache,log}

WORKDIR /app

Expand All @@ -97,4 +98,4 @@ COPY --from=builder /app/config/config_helper.exs ./config/config_helper.exs
COPY --from=builder /app/config/config_helper.exs /app/releases/${RELEASE_VERSION}/config_helper.exs

COPY docker/run.sh /run.sh
CMD ["/bin/sh", "/run.sh"]
CMD ["/bin/sh", "/run.sh"]

1 comment on commit 75fdc66

@vercel
Copy link

@vercel vercel bot commented on 75fdc66 Sep 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.