<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="334197" data-post-id="334197">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Raf" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Raf/120/26774_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Raf
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p><strong>NOTE:</strong> Found a solution to the problem I was having. See <strong>edit2</strong> note below.</p>
</blockquote>
<p>I’ve been struggling with this issue for a few hours now. I’m on macOS and the project runs just fine on my machine, but to deploy (to AWS), I need to build a docker image passing <code>--platform=linux/amd64</code>, e.g.:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">ARG ELIXIR_VERSION=1.17.2
ARG OTP_VERSION=27.0.1
ARG NODE_VERSION=20.x
ARG DEBIAN_VERSION=bullseye-20240701-slim

ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"

# ---- stage: builder
FROM --platform=linux/amd64 ${BUILDER_IMAGE} AS builder
</code></pre>
<p>The Elixir version I have there is quite new, but I had it set to 1.16 before and it presented the same issue. When I try to build, this is the error I get:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"> =&gt; [builder  8/18] COPY mix.exs mix.lock ./                                                                                             0.0s
 =&gt; [builder  9/18] RUN mix deps.get --only prod                                                                                         3.9s
 =&gt; ERROR [builder 10/18] RUN mix deps.compile                                                                                           1.7s
------
 &gt; [builder 10/18] RUN mix deps.compile:
1.165 ==&gt; decimal
1.165 Compiling 4 files (.ex)
1.669 Generated decimal app
1.675 ==&gt; my_app_name
1.676 Error while loading project :mime at /app/deps/mime
1.678 ** (ArgumentError) could not call Module.put_attribute/3 because the module MyAppName.MixProject is already compiled
1.678     (elixir 1.17.2) lib/module.ex:2365: Module.assert_not_readonly!/2
1.678     (elixir 1.17.2) lib/module.ex:2046: Module.__put_attribute__/5
1.678     /app/deps/mime/mix.exs:2: (module)
------
Dockerfile:59
--------------------
  57 |     COPY mix.exs mix.lock ./
  58 |     RUN mix deps.get --only $MIX_ENV
  59 | &gt;&gt;&gt; RUN mix deps.compile
  60 |
  61 |     COPY assets assets
--------------------
ERROR: failed to solve: process "/bin/sh -c mix deps.compile" did not complete successfully: exit code: 1
</code></pre>
<p>The image builds just fine if I don’t pass the <code>--platform</code>, so if I have:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">FROM ${BUILDER_IMAGE} AS builder
</code></pre>
<p>Then the image builds and runs fine on my machine, but then I can’t use in in AWS - at least with what I have access (all other services are built for amd64 to work on our infra.</p>
<p>Any help at this point would be much appreciated!</p>
<p><strong>edit:</strong> Just found this other related question here: <a href="https://forum.elixirforum.com/t/cross-platform-specific-error-when-installing-latest-hex/62817" class="inline-onebox" rel="nofollow">Cross-platform specific error when installing latest hex</a> (unfortunately, without a solution - I’ll keep looking).</p>
<p><strong>edit2:</strong> Finally found a solution to the problem in this other question: <a href="https://forum.elixirforum.com/t/elixir-docker-image-wont-build-for-linux-arm64-v8-using-github-actions/56383/13" class="inline-onebox" rel="nofollow">Elixir docker image won't build for linux/arm64/v8 using Github Actions - #13 by yuriploc</a></p>
<p>It suggests adding <code>ERL_FLAGS="+JPperf true"</code> to the environment and so I did in my Dockerfile, so now I have:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">FROM --platform=linux/amd64 ${BUILDER_IMAGE} AS builder
...
# set build ENV
ENV MIX_ENV="prod"
ENV ERL_FLAGS="+JPperf true"

# install mix dependencies
COPY mix.exs mix.lock ./
RUN mix deps.get --only $MIX_ENV
RUN mkdir config

# copy compile-time config files before we compile dependencies
# to ensure any relevant config change will trigger the dependencies
# to be re-compiled.
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="334197" data-batch-url="/posts/batch_likers">
                        15
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/unable-to-compile-default-elixir-project-from-the-getting-started-guide/57199/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-334197" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="334197"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="339548" data-post-id="339548">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="braydengirard" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/braydengirard/120/35954_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  braydengirard
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thank you! I was experiencing the same error when trying to deploy with Kamal on an ARM Mac to an AMD64 Ubuntu server. This seems to have worked.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="339548" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/unable-to-compile-default-elixir-project-from-the-getting-started-guide/57199/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-339548" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="339548"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="368953" data-post-id="368953">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="vipulbhj" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/vipulbhj/120/38408_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  vipulbhj
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thank you so much <img src="https://forum.elixirforum.com/images/emoji/apple/folded_hands.png?v=15" title=":folded_hands:" class="emoji" alt=":folded_hands:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="368953" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/unable-to-compile-default-elixir-project-from-the-getting-started-guide/57199/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-368953" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="368953"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>