Skip to content

Instantly share code, notes, and snippets.

@entone
Last active October 3, 2020 03:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save entone/b0a70be6132c78909a58d2dfb1c49cbb to your computer and use it in GitHub Desktop.
Save entone/b0a70be6132c78909a58d2dfb1c49cbb to your computer and use it in GitHub Desktop.
Elixir 1.9 example Dockerfile
/_build/
# If you run "mix test --cover", coverage assets end up here.
/cover/
# The directory Mix downloads your dependencies sources to.
/deps/
# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/
# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch
# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump
# Also ignore archive artifacts (built via "mix archive.build").
*.ez
/test/
FROM elixir:1.9.1 AS app_builder
WORKDIR /app
ENV MIX_ENV=prod
COPY mix.*
RUN mix do local.hex --force, local.rebar --force, deps.get, deps.compile
COPY . .
RUN mix do phx.digest, release app
# ---- Release Stage ----
FROM debian:stretch AS app
EXPOSE 4000
ENV LANG=C.UTF-8
RUN apt-get update && apt-get install -y openssl
RUN useradd --create-home app
WORKDIR /app
COPY --from=app_builder /app/_build/prod/rel/app ./
ENTRYPOINT ["/app/bin/app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment