Skip to content

Instantly share code, notes, and snippets.

@watsy0007
Forked from entone/Dockerfile
Created December 26, 2019 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save watsy0007/51435fdabd331422ab676c6839e3311f to your computer and use it in GitHub Desktop.
Save watsy0007/51435fdabd331422ab676c6839e3311f to your computer and use it in GitHub Desktop.
FROM elixir:1.9.1-alpine as build
# # install build dependencies
RUN apk add --no-cache \
gcc \
g++ \
git \
make \
musl-dev
RUN mix do local.hex --force, local.rebar --force
WORKDIR /app
FROM build as deps
COPY mix.exs mix.lock ./
ARG MIX_ENV=prod
ENV MIX_ENV=$MIX_ENV
RUN mix do deps.get --only=$MIX_ENV, deps.compile
FROM deps as releaser
COPY . .
ENV MIX_ENV=$MIX_ENV
RUN mix release app
FROM alpine:3.9
RUN apk add --no-cache bash libstdc++ openssl
WORKDIR /app
COPY --from=releaser /app/_build/prod/rel/app ./
EXPOSE 4000
ENTRYPOINT ["/app/bin/app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment