-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
45 lines (33 loc) · 1023 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
ARG ERLANG_VERSION
ARG ELIXIR_VERSION
ARG ALPINE_VERSION
FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_VERSION}-alpine-${ALPINE_VERSION} AS base
# Install tooling
RUN apk add --no-cache bash tini git curl
FROM base AS build
# Setting up env
ARG MIX_ENV
ENV MIX_ENV=${MIX_ENV}
ENV MIX_HOME=/opt/app/mix
ENV CACHE_VERSION=v1
# Switch to working directory
WORKDIR /opt/app
# Install mix dependencies
RUN mix local.hex --force && \
mix local.rebar --force
COPY mix.exs mix.lock ./
RUN mix deps.get
# Copy app and compile
COPY . .
# Copy compile-time config files before we compile dependencies
# to ensure any relevant config change will trigger the dependencies
# to be re-compiled.
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
COPY priv/gettext priv/gettext
COPY priv/repo priv/repo
# Generate revision file
ARG REVISION
RUN echo ${REVISION} > /opt/app/built_from_revision
# https://github.com/krallin/tini for better signal handling.
ENTRYPOINT ["/sbin/tini", "-s", "--"]