Update Docker setup to be compatible with Erlang/OTP 23

pull/3487/head
Victor Baranov 4 years ago
parent c046ec07cd
commit f71aeb12ec
  1. 1
      CHANGELOG.md
  2. 16
      docker/Dockerfile
  3. 13
      docker/Makefile

@ -18,6 +18,7 @@
- [#3457](https://github.com/poanetwork/blockscout/pull/3457) - Fix doubled token transfer on block's page if block has reorg
### Chore
- [#3487](https://github.com/poanetwork/blockscout/pull/3487) - Docker setup update to be compatible with Erlang OTP 23
- [#3484](https://github.com/poanetwork/blockscout/pull/3484) - Elixir upgrade to 11.2
- [#3483](https://github.com/poanetwork/blockscout/pull/3483) - Update outdated dependencies
- [#3483](https://github.com/poanetwork/blockscout/pull/3483) - Migrate to Erlang/OTP 23

@ -1,6 +1,12 @@
FROM bitwalker/alpine-elixir-phoenix:latest
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3
# Get Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="$HOME/.cargo/bin:${PATH}"
ENV RUSTFLAGS="-C target-feature=-crt-static"
EXPOSE 4000
@ -33,12 +39,6 @@ RUN cd apps/block_scout_web/assets/ && \
RUN cd apps/explorer/ && \
npm install && \
apk update && apk del --force-broken-world alpine-sdk gmp-dev automake libtool inotify-tools autoconf python
# RUN mix do ecto.drop --force, ecto.create, ecto.migrate
apk update && apk del --force-broken-world alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3
RUN mix phx.digest
# USER default
# CMD ["mix", "phx.server"]

@ -3,7 +3,7 @@ HOST = host.docker.internal
DOCKER_IMAGE = blockscout_prod
BS_CONTAINER_NAME = blockscout
PG_CONTAINER_NAME = postgres
PG_CONTAINER_IMAGE = postgres:12.4
PG_CONTAINER_IMAGE = postgres:12.5
THIS_FILE = $(lastword $(MAKEFILE_LIST))
ifeq ($(SYSTEM), Linux)
@ -273,7 +273,7 @@ ifdef DISABLE_KNOWN_TOKENS
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_KNOWN_TOKENS=$(DISABLE_KNOWN_TOKENS)'
endif
HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep ${DOCKER_IMAGE})
HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep -sw ${DOCKER_IMAGE})
build:
@echo "==> Checking for blockscout image $(DOCKER_IMAGE)"
ifdef HAS_BLOCKSCOUT_IMAGE
@ -283,12 +283,15 @@ else
@docker build --build-arg COIN="$(COIN)" -f ./Dockerfile -t $(DOCKER_IMAGE) ../
endif
migrate: build postgres
migrate_only:
@echo "==> Running migrations"
@docker run --rm \
$(BLOCKSCOUT_CONTAINER_PARAMS) \
$(DOCKER_IMAGE) /bin/sh -c "echo $$MIX_ENV && mix do ecto.create, ecto.migrate"
migrate: build postgres
@$(MAKE) -f $(THIS_FILE) migrate_only
PG_EXIST := $(shell docker ps -a --filter name=${PG_CONTAINER_NAME} | grep ${PG_CONTAINER_NAME})
PG_STARTED := $(shell docker ps --filter name=${PG_CONTAINER_NAME} | grep ${PG_CONTAINER_NAME})
@ -297,9 +300,11 @@ ifdef PG_EXIST
@echo "==> Checking PostrgeSQL container"
ifdef PG_STARTED
@echo "==> PostgreSQL Already started"
@$(MAKE) -f $(THIS_FILE) migrate_only
else
@echo "==> Starting PostgreSQL container"
@docker start $(PG_CONTAINER_NAME)
@$(MAKE) -f $(THIS_FILE) migrate_only
endif
else
@echo "==> Creating new PostgreSQL container"
@ -310,7 +315,7 @@ else
-p 5432:5432 \
$(PG_CONTAINER_IMAGE)
@sleep 1
@$(MAKE) -f $(THIS_FILE) migrate
@$(MAKE) -f $(THIS_FILE) migrate_only
endif
start: build postgres

Loading…
Cancel
Save