-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (31 loc) · 918 Bytes
/
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
FROM hexpm/elixir:1.13.4-erlang-24.3.4-alpine-3.14.0 as builder
# The nuclear approach:
# RUN apk add --no-cache alpine-sdk
RUN apk add --no-cache gcc git make musl-dev
RUN mix local.rebar --force && mix local.hex --force
WORKDIR /app
ENV MIX_ENV=prod
COPY mix.* /app/
RUN mix deps.get --only prod
RUN mix deps.compile
FROM node:16.15 as frontend
WORKDIR /app
COPY assets/package.json assets/yarn.lock /app/
COPY --from=builder /app/deps/phoenix /deps/phoenix
COPY --from=builder /app/deps/phoenix_html /deps/phoenix_html
RUN yarn install
COPY assets /app
RUN npm run deploy
FROM builder as releaser
COPY --from=frontend /priv/static /app/priv/static
COPY . /app/
RUN mix phx.digest
RUN mix release
FROM alpine:3.14.0
RUN apk add -U bash openssl libgcc libstdc++
WORKDIR /app
COPY --from=releaser /app/_build/prod/rel/stein_example /app/
ENV MIX_ENV=prod
EXPOSE 4000
ENTRYPOINT ["bin/stein_example"]
CMD ["start"]