Clean up release

pull/5713/head
Qwerty5Uiop 2 years ago
parent dd9418c4e8
commit f4799e0674
  1. 23
      apps/explorer/lib/release_tasks.ex
  2. 18
      docker/Dockerfile

@ -16,6 +16,19 @@ defmodule Explorer.ReleaseTasks do
@repos Application.compile_env(:blockscout, :ecto_repos, [Explorer.Repo])
def create_and_migrate do
start_services()
create()
run_migrations()
stop_services()
end
def create do
Enum.each(@repos, &create_db_for/1)
end
def migrate(_argv) do
start_services()
@ -51,6 +64,16 @@ defmodule Explorer.ReleaseTasks do
:init.stop()
end
defp create_db_for(repo) do
IO.puts("Create #{inspect(repo)} database if it doesn't exist")
case repo.__adapter__.storage_up(repo.config) do
:ok -> :ok
{:error, :already_up} -> :ok
{:error, term} -> {:error, term}
end
end
defp run_migrations do
Enum.each(@repos, &run_migrations_for/1)
end

@ -1,4 +1,6 @@
FROM bitwalker/alpine-elixir-phoenix:1.13
FROM bitwalker/alpine-elixir-phoenix:1.13 AS builder
WORKDIR /opt/app
RUN apk --no-cache --update add alpine-sdk gmp-dev automake libtool inotify-tools autoconf python3 file qemu-x86_64
@ -64,5 +66,15 @@ RUN cd apps/explorer/ && \
RUN mix phx.digest
RUN mix release blockscout \
&& cp -R _build/${MIX_ENV}/rel/blockscout/* ./
RUN mkdir -p /opt/release \
&& mix release blockscout \
&& mv _build/${MIX_ENV}/rel/blockscout /opt/release
##############################################################
FROM bitwalker/alpine-elixir-phoenix:1.13
WORKDIR /opt/app
COPY --from=builder /opt/release/blockscout .

Loading…
Cancel
Save