Skip to content

Commit

Permalink
Merge pull request #254 from CaptainFact/feat/docker-release
Browse files Browse the repository at this point in the history
Update Dockerfile for monolith
  • Loading branch information
Betree committed Aug 28, 2020
2 parents 139e98c + 031f1cd commit c937304
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 9 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,24 @@ 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 /opt/app/bin/full_app /opt/app/entrypoint
RUN ls

EXPOSE 80
ENTRYPOINT ["./bin/entrypoint"]
ENTRYPOINT /opt/app/entrypoint start
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 c937304

Please sign in to comment.