Skip to content

Instantly share code, notes, and snippets.

@sheharyarn
Last active April 15, 2020 16:01
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 sheharyarn/db4e433d5c490c9fb0bafa1550c8dfaa to your computer and use it in GitHub Desktop.
Save sheharyarn/db4e433d5c490c9fb0bafa1550c8dfaa to your computer and use it in GitHub Desktop.
Minimal Dockerfile for simple Elixir applications
# Build the release
# -----------------
FROM elixir:1.9.0-alpine as build
ENV MIX_ENV=prod
WORKDIR /source
RUN mix local.hex --force && mix local.rebar --force
# Cache dependencies
COPY mix.exs mix.lock config ./
RUN mix do deps.get, deps.compile
# Compile and build the app
COPY . .
RUN mix do compile, release
# Run the app
# -----------
FROM elixir:1.9.0-alpine
ENV MIX_ENV=prod
EXPOSE 3000
WORKDIR /app
COPY --from=build /source/_build/${MIX_ENV}/rel/my_app .
CMD ["bin/my_app", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment