1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-23 08:22:50 +00:00
mobilizon/docker/production/Dockerfile

45 lines
949 B
Text
Raw Normal View History

2020-10-22 13:19:01 +00: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
2020-10-22 13:19:01 +00:00
# Then, build the application binary
FROM elixir:alpine AS builder
RUN apk add --no-cache build-base git cmake
COPY mix.exs mix.lock ./
ENV MIX_ENV=prod
2020-10-22 13:19:01 +00:00
RUN mix local.hex --force \
&& mix local.rebar --force \
&& mix deps.get
2020-10-22 13:19:01 +00:00
COPY lib ./lib
COPY priv ./priv
COPY config ./config
COPY rel ./rel
2020-10-22 13:19:01 +00:00
COPY docker/production/releases.exs ./config/
COPY --from=assets ./priv/static ./priv/static
RUN mix phx.digest \
&& mix release
2020-10-22 13:19:01 +00:00
# Finally setup the app
FROM alpine
RUN apk add --no-cache openssl ncurses-libs file postgresql-client
2020-10-22 13:19:01 +00:00
RUN mkdir -p /app/uploads && chown nobody:nobody /app/uploads
2020-10-22 13:19:01 +00:00
USER nobody
EXPOSE 4000
2020-10-22 13:19:01 +00:00
COPY --from=builder --chown=nobody:nobody _build/prod/rel/mobilizon ./
COPY docker/production/docker-entrypoint.sh ./
2020-10-22 13:19:01 +00:00
ENTRYPOINT ["./docker-entrypoint.sh"]