2020-10-22 15:19:01 +02:00
|
|
|
# First build the application assets
|
|
|
|
FROM node:alpine as assets
|
|
|
|
|
|
|
|
RUN apk add --no-cache python build-base
|
|
|
|
|
|
|
|
COPY js .
|
|
|
|
RUN yarn install \
|
|
|
|
&& yarn run build
|
|
|
|
|
|
|
|
# Then, build the application binary
|
|
|
|
FROM elixir:alpine AS builder
|
|
|
|
|
|
|
|
RUN apk add --no-cache build-base git cmake
|
|
|
|
|
|
|
|
COPY mix.exs mix.lock ./
|
2020-10-19 01:01:59 +02:00
|
|
|
ENV MIX_ENV=prod
|
2020-10-22 15:19:01 +02:00
|
|
|
RUN mix local.hex --force \
|
|
|
|
&& mix local.rebar --force \
|
|
|
|
&& mix deps.get
|
2020-10-19 01:01:59 +02:00
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
COPY lib ./lib
|
|
|
|
COPY priv ./priv
|
|
|
|
COPY config ./config
|
|
|
|
COPY docker/production/releases.exs ./config/
|
|
|
|
COPY --from=assets ./priv/static ./priv/static
|
|
|
|
|
|
|
|
RUN mix phx.digest \
|
|
|
|
&& mix release
|
|
|
|
|
|
|
|
# Finally setup the app
|
|
|
|
FROM alpine
|
|
|
|
|
|
|
|
RUN apk add --no-cache openssl ncurses-libs
|
|
|
|
|
|
|
|
USER nobody
|
2020-10-19 01:01:59 +02:00
|
|
|
EXPOSE 4000
|
|
|
|
|
2020-10-22 15:19:01 +02:00
|
|
|
COPY --from=builder --chown=nobody:nobody _build/prod/rel/mobilizon ./
|
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/mobilizon"]
|
|
|
|
CMD ["start"]
|