zcash-explorer/Dockerfile

50 lines
914 B
Docker
Raw Normal View History

2023-06-15 07:34:22 -07:00
FROM elixir:1.14.4-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-07-07 10:40:43 -07:00
COPY mix.exs mix.lock ./
COPY config config
RUN mix do deps.get, deps.compile
2023-06-15 07:34:22 -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
RUN npm run deploy --prefix=assets
2021-07-07 10:40:43 -07:00
RUN mix phx.digest
RUN mix do release
2021-07-07 10:40:43 -07:00
# prepare release image
2023-06-15 07:34:22 -07:00
FROM alpine:3.17.3 AS app
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
CMD ["bin/zcash_explorer", "start"]