Skip to content

Commit

Permalink
Use Cargo Sparse protocol in Docker build
Browse files Browse the repository at this point in the history
Cargo 1.68 and newer introduced "sparse" protocol which significantly reduces memory usage (and improves build time!) - see https://blog.rust-lang.org/inside-rust/2023/01/30/cargo-sparse-protocol.html

Had to bump Alpine to 3.18 to pick up a more recent Cargo release (1.76.0)

hexpm/elixir do not sure Alpine 3.19 with current erlang+elixir combination
  • Loading branch information
jippi authored Apr 27, 2024
1 parent ade2598 commit 1e00214
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG ALPINE_VERSION=3.17.0
ARG ALPINE_VERSION=3.18.0
ARG ERLANG_OTP_VERSION=25.2.2
ARG ELIXIR_VERSION=1.14.3

Expand All @@ -9,6 +9,9 @@ FROM docker.io/hexpm/elixir:${ELIXIR_VERSION}-erlang-${ERLANG_OTP_VERSION}-alpin

ARG MIX_ENV=prod
ENV ERL_FLAGS="+JPperf true"
# Avoid "error 137" (out of memory) while building images
# See https://github.com/rust-lang/cargo/issues/10781
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"

WORKDIR /opt/app

Expand Down

0 comments on commit 1e00214

Please sign in to comment.