Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves build tasks from build.sh to Dockerfile (#2223) #2244

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,36 @@ RUN apt -q update && \
RUN mix local.hex --force
RUN mix local.rebar --force

FROM dev AS release

ENV MIX_ENV=prod

ADD mix.exs mix.lock /app/
ADD config /app/config
WORKDIR /app

RUN mix deps.get --only prod
RUN mix deps.get
RUN mix deps.compile

ADD . /app
RUN mix compile
RUN mix phx.digest

FROM node:10 as js

COPY --from=dev /deps /deps
ADD . /app
WORKDIR /app

RUN yarn install --no-progress
RUN yarn deploy

FROM dev AS release

COPY --from=js /app/assets /app/

ENV MIX_ENV=prod
ENV PORT=80

WORKDIR /app
EXPOSE 80

CMD elixir --sname server -S mix phx.server