Last active
April 15, 2020 16:01
-
-
Save sheharyarn/db4e433d5c490c9fb0bafa1550c8dfaa to your computer and use it in GitHub Desktop.
Minimal Dockerfile for simple Elixir applications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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