Skip to content

Commit

Permalink
rel: Update Dockerfile for monolith
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree committed Aug 27, 2020
1 parent 139e98c commit 031f1cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM bitwalker/alpine-elixir:1.6.6
FROM bitwalker/alpine-elixir:1.10.2
RUN apk update && apk upgrade
RUN apk add bash imagemagick curl gcc make libc-dev libgcc && rm -rf /var/cache/apk/*

Expand All @@ -12,22 +12,23 @@ COPY apps/cf_atom_feed/mix.exs ./apps/cf_atom_feed/
COPY apps/cf_graphql/mix.exs ./apps/cf_graphql/
COPY apps/cf_jobs/mix.exs ./apps/cf_jobs/
COPY apps/cf_rest_api/mix.exs ./apps/cf_rest_api/
COPY apps/cf_reverse_proxy/mix.exs ./apps/cf_reverse_proxy/
COPY apps/db/mix.exs ./apps/db/
RUN HEX_HTTP_CONCURRENCY=4 HEX_HTTP_TIMEOUT=180 mix deps.get
RUN HEX_HTTP_CONCURRENCY=4 HEX_HTTP_TIMEOUT=180 mix deps.get --only $MIX_ENV

# Build dependencies
COPY . .
RUN mix deps.compile

# Build app
ARG APP
RUN mix distillery.release --name ${APP} --env=$MIX_ENV
RUN mix compile
RUN mix release

# Copy app to workdir and remove build files
WORKDIR /opt/app
RUN mv /opt/build/_build/$MIX_ENV/rel/${APP}/* /opt/app/
RUN mv /opt/build/_build/$MIX_ENV/rel/full_app/* /opt/app/
RUN rm -rf /opt/build
RUN ln -s /opt/app/bin/${APP} bin/entrypoint
RUN ln -s _build/$MIX_ENV/rel/full_app/bin/full_app app

EXPOSE 80
ENTRYPOINT ["./bin/entrypoint"]
ENTRYPOINT ["./app"]
5 changes: 2 additions & 3 deletions rel/test_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ export CF_PORT=4242
mix release --overwrite
_build/prod/rel/full_app/bin/full_app start

# With Distillery
# mix distillery.release --env prod --name cf_full_app
# _build/prod/rel/cf_full_app/bin/cf_full_app foreground
# With Docker
# docker build -t cf-test-release .

0 comments on commit 031f1cd

Please sign in to comment.