forked from papercups-io/papercups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
production.Dockerfile
63 lines (45 loc) · 1.35 KB
/
production.Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM elixir:1.10.4-alpine as builder
# build step
ARG MIX_ENV=prod
ARG NODE_ENV=production
ARG APP_VER=0.0.1
ENV APP_VERSION=$APP_VER
RUN mkdir /app
WORKDIR /app
RUN apk add --no-cache git nodejs yarn python npm ca-certificates wget gnupg make erlang gcc libc-dev && \
npm install npm@latest -g
# Client side
COPY assets/package.json assets/package-lock.json ./assets/
RUN npm install --prefix=assets
# fix because of https://github.com/facebook/create-react-app/issues/8413
ENV GENERATE_SOURCEMAP=false
COPY priv priv
COPY assets assets
RUN npm run build --prefix=assets
COPY mix.exs mix.lock ./
COPY config config
RUN mix local.hex --force && \
mix local.rebar --force && \
mix deps.get --only prod
COPY lib lib
RUN mix deps.compile
RUN mix phx.digest priv/static
WORKDIR /app
COPY rel rel
RUN mix release papercups
FROM alpine:3.9 AS app
RUN apk add --no-cache openssl ncurses-libs
ENV LANG=C.UTF-8
EXPOSE 4000
WORKDIR /app
ENV HOME=/app
RUN adduser -h /app -u 1000 -s /bin/sh -D papercupsuser
COPY --from=builder --chown=papercupsuser:papercupsuser /app/_build/prod/rel/papercups /app
COPY --from=builder --chown=papercupsuser:papercupsuser /app/priv /app/priv
RUN chown -R papercupsuser:papercupsuser /app
COPY docker-entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh
USER papercupsuser
WORKDIR /app
ENTRYPOINT ["/entrypoint.sh"]
CMD ["run"]