mobilizon.chapril.org-mobil.../docker/production/Dockerfile
Thomas Citharel 4d87541d96
Stick to stable version of the Docker base images
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2021-02-05 15:19:17 +01:00

45 lines
996 B
Docker

# First build the application assets
FROM node:14-alpine as assets
RUN apk add --no-cache python build-base libwebp-tools bash imagemagick ncurses
COPY js .
RUN yarn install \
&& yarn run build
# Then, build the application binary
FROM elixir:1.11-alpine AS builder
RUN apk add --no-cache build-base git cmake
COPY mix.exs mix.lock ./
ENV MIX_ENV=prod
RUN mix local.hex --force \
&& mix local.rebar --force \
&& mix deps.get
COPY lib ./lib
COPY priv ./priv
COPY config ./config
COPY rel ./rel
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 file postgresql-client
RUN mkdir -p /app/uploads && chown nobody:nobody /app/uploads
USER nobody
EXPOSE 4000
COPY --from=builder --chown=nobody:nobody _build/prod/rel/mobilizon ./
COPY docker/production/docker-entrypoint.sh ./
ENTRYPOINT ["./docker-entrypoint.sh"]