fireproofsocks
Docker build: failed to compute cache key: "/app/_build/rel/my_app" not found: not found
I’m trying to get a working Dockerfile – I started with mix phx.gen.release --docker and that was a great start. I had to tweak a few things (as expected). I’m figuring out how to get an SSH key in there (using https://medium.com/trabe/use-your-local-ssh-keys-inside-a-docker-container-ea1d117515dc) so I can checkout private packages. I added a chunk something like this:
RUN useradd -m user
RUN mkdir -p /home/user/.ssh
COPY id_rsa /home/user/.ssh/id_rsa
RUN chown -R user:user /home/user/.ssh
RUN echo "Host *.github.com\n\tStrictHostKeyChecking no\n" >> /home/user/.ssh/config
RUN echo "github.com,140.82.113.3 ssh-rsa xxxxxxx\n" >> /home/user/.ssh/known_hosts
USER user
And that almost gets the thing to build via docker build .
=> ERROR [stage-1 6/6] COPY --from=builder --chown=nobody:root /app/_build/rel/my_app ./ 0.0s
------
> [stage-1 6/6] COPY --from=builder --chown=nobody:root /app/_build/rel/my_app ./:
------
failed to compute cache key: "/app/_build/rel/my_app" not found: not found
I have a custom build location:
defp releases do
[
my_app: [
include_executables_for: [:unix],
steps: [:assemble, :tar],
overlays: ["envs/", "priv/", "config/"],
path: "_build/rel"
]
]
end
But I can’t quite figure out what needs to change to make this work. Can anyone point me in the right direction?
Most Liked
ollien
FYI, I know you figured this out, but as an aside, you might consider using ssh-keyscan to populate that known_hosts file, rather than a single IP address. Of course this is at build-time, so the public key and/or addresses may change at any time after the image is built, so you may consider doing it at runtime, but I thought you might find it useful either way ![]()
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









