Split Dockerfile build steps for better layer caching
This commit is contained in:
parent
84e883701d
commit
f1ead99e24
1 changed files with 8 additions and 6 deletions
14
Dockerfile
14
Dockerfile
|
|
@ -27,17 +27,19 @@ COPY mix.exs mix.lock ./
|
||||||
RUN mix deps.get --only $MIX_ENV && \
|
RUN mix deps.get --only $MIX_ENV && \
|
||||||
mix deps.compile
|
mix deps.compile
|
||||||
|
|
||||||
# Copy and compile application
|
# Copy config and application code, then compile
|
||||||
COPY config config
|
COPY config config
|
||||||
COPY lib lib
|
COPY lib lib
|
||||||
|
RUN mix compile
|
||||||
|
|
||||||
|
# Copy assets and static files, then deploy assets
|
||||||
COPY assets assets
|
COPY assets assets
|
||||||
COPY priv priv
|
COPY priv priv
|
||||||
COPY rel rel
|
RUN mix assets.deploy
|
||||||
|
|
||||||
# Build application
|
# Copy release config and build release
|
||||||
RUN mix compile && \
|
COPY rel rel
|
||||||
mix assets.deploy && \
|
RUN mix release
|
||||||
mix release
|
|
||||||
|
|
||||||
# Runtime stage
|
# Runtime stage
|
||||||
FROM ${RUNNER_IMAGE}
|
FROM ${RUNNER_IMAGE}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue