Last active
May 12, 2019 11:56
-
-
Save timbuchwaldt/cfa7da0d9f90d89e6755b40859850433 to your computer and use it in GitHub Desktop.
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
#!/bin/sh -eu | |
rm -rf .depscache | |
mkdir .depscache | |
rsync -r --exclude=.depscache . .depscache | |
pushd .depscache | |
find . -type f ! -wholename '*mix.*' -a -type f ! -wholename "*config/*" -delete | |
find . -type d -empty -delete | |
popd | |
DOCKER_BUILDKIT=1 docker build . |
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
FROM elixir as build | |
RUN mix local.hex --force && mix local.rebar --force | |
ADD .depscache/ /app/ | |
RUN cd /app && mix deps.get && mix deps.compile && MIX_ENV=test mix deps.compile && MIX_ENV=prod mix deps.compile | |
FROM elixir | |
RUN mix local.hex --force && mix local.rebar --force | |
ADD . /app | |
COPY --from=build /app/_build /app/_build | |
COPY --from=build /app/deps /app/deps | |
RUN cd /app && mix compile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This could greatly benefit from caching
deps
during runs so stuff isn't fetched multiple times.