2021-08-20 07:48:06 -07:00
|
|
|
FROM elixir:1.12.2-alpine AS build
|
2021-07-07 10:40:43 -07:00
|
|
|
|
|
|
|
# install build dependencies
|
|
|
|
RUN apk add --update --no-cache build-base --update nodejs npm git
|
|
|
|
|
|
|
|
# prepare build dir
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# install hex + rebar
|
|
|
|
RUN mix local.hex --force && \
|
|
|
|
mix local.rebar --force
|
|
|
|
|
|
|
|
# set build ENV
|
|
|
|
ENV MIX_ENV=prod
|
|
|
|
|
2021-08-20 07:48:06 -07:00
|
|
|
|
2021-07-07 10:40:43 -07:00
|
|
|
COPY mix.exs mix.lock ./
|
|
|
|
COPY config config
|
|
|
|
RUN mix do deps.get, deps.compile
|
|
|
|
|
2021-08-20 07:48:06 -07:00
|
|
|
COPY assets/package.json ./assets/
|
|
|
|
RUN npm install --prefix=assets
|
|
|
|
|
|
|
|
# should be before running npm deploy
|
|
|
|
COPY lib lib
|
|
|
|
copy rel rel
|
2021-07-07 10:40:43 -07:00
|
|
|
|
|
|
|
COPY priv priv
|
|
|
|
COPY assets assets
|
2021-08-20 07:48:06 -07:00
|
|
|
RUN npm run deploy --prefix=assets
|
2021-07-07 10:40:43 -07:00
|
|
|
|
2021-08-20 07:48:06 -07:00
|
|
|
RUN mix phx.digest
|
|
|
|
RUN mix do release
|
2021-07-07 10:40:43 -07:00
|
|
|
|
|
|
|
# prepare release image
|
|
|
|
FROM alpine:3.14 AS app
|
2021-08-20 07:48:06 -07:00
|
|
|
RUN apk add --no-cache openssl ncurses-libs libstdc++ libgcc
|
2021-07-07 10:40:43 -07:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
RUN chown nobody:nobody /app
|
|
|
|
|
|
|
|
USER nobody:nobody
|
|
|
|
|
|
|
|
COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/zcash_explorer ./
|
|
|
|
|
|
|
|
ENV HOME=/app
|
|
|
|
|
2021-08-20 07:48:06 -07:00
|
|
|
CMD ["bin/zcash_explorer", "start"]
|