Created
September 16, 2019 22:57
-
-
Save christopherlai/0503bee142b6fe1b64f0496376c3ea98 to your computer and use it in GitHub Desktop.
Example Dockerfile for Elixir 1.9.1 umbrella project
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:1.9.1-alpine as build | |
ENV MIX_ENV=prod | |
WORKDIR /build | |
RUN apk add --no-cache build-base nodejs yarn && \ | |
mix local.hex --force && \ | |
mix local.rebar --force | |
COPY mix.exs mix.lock config/ ./ | |
COPY apps/web/mix.exs ./apps/web/ | |
COPY apps/database/mix.exs ./apps/database/ | |
RUN mix deps.get --only prod && \ | |
mix deps.compile | |
COPY . . | |
RUN yarn --cwd apps/web/assets install --pure-lockfile && \ | |
yarn --cwd apps/web/assets deploy && \ | |
cd apps/web && mix phx.digest | |
RUN mix release | |
FROM elixir:1.9.1-alpine | |
RUN addgroup -S release && \ | |
adduser -S -G release release && \ | |
mkdir /release && \ | |
chown -R release: /release | |
WORKDIR /release | |
COPY --from=build --chown=release:release /build/_build/prod/rel/projectx . | |
USER release | |
EXPOSE 4000 | |
CMD ["bin/projectx", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment