Heroku Container multi-stage build failing to find file












0















I have a docker file with two stages which successfully builds locally. When I attempt to push it to the heroku's container service it fails to build with an error that a file is not available.



Error



** (Mix.Config.LoadError) could not load config config/prod.exs
** (ArgumentError) argument error
:erlang.binary_to_integer("")
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
(stdlib) erl_eval.erl:236: :erl_eval.expr/5


Dockerfile



FROM bitwalker/alpine-elixir-phoenix:1.5.2 as builder

ARG CLOAK_ENCRYPTION_KEY
ARG DATABASE_URL


ENV MIX_ENV=prod PORT=$PORT DATABASE_URL=$DATABASE_URL CLOAK_ENCRYPTION_KEY=$CLOAK_ENCRYPTION_KEY

WORKDIR /app

# Cache elixir deps
ADD mix.exs mix.lock /app/
RUN mix do deps.get, deps.compile

# Same with npm deps
ADD client/package.json client/package-lock.json /app/client/
RUN cd client &&
npm install

ADD . .

# Run frontend build, compile, and digest assets
RUN cd /app/client/ &&
npm run build &&
cd /app &&
mix do compile

RUN MIX_ENV=prod mix release --env=prod --verbose --no-tar

### Release

FROM alpine:3.8

# We need bash and openssl for Phoenix
RUN apk upgrade --no-cache &&
apk add --no-cache bash openssl

ENV SHELL=/bin/bash

COPY --from=builder /app/_build/prod/rel/myapp/app

ENTRYPOINT ["/app/bin/myapp"]

CMD ["foreground"]


The error occurs at the second mix do compile



What cause this to work locally, but fail on Heroku?










share|improve this question





























    0















    I have a docker file with two stages which successfully builds locally. When I attempt to push it to the heroku's container service it fails to build with an error that a file is not available.



    Error



    ** (Mix.Config.LoadError) could not load config config/prod.exs
    ** (ArgumentError) argument error
    :erlang.binary_to_integer("")
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:236: :erl_eval.expr/5


    Dockerfile



    FROM bitwalker/alpine-elixir-phoenix:1.5.2 as builder

    ARG CLOAK_ENCRYPTION_KEY
    ARG DATABASE_URL


    ENV MIX_ENV=prod PORT=$PORT DATABASE_URL=$DATABASE_URL CLOAK_ENCRYPTION_KEY=$CLOAK_ENCRYPTION_KEY

    WORKDIR /app

    # Cache elixir deps
    ADD mix.exs mix.lock /app/
    RUN mix do deps.get, deps.compile

    # Same with npm deps
    ADD client/package.json client/package-lock.json /app/client/
    RUN cd client &&
    npm install

    ADD . .

    # Run frontend build, compile, and digest assets
    RUN cd /app/client/ &&
    npm run build &&
    cd /app &&
    mix do compile

    RUN MIX_ENV=prod mix release --env=prod --verbose --no-tar

    ### Release

    FROM alpine:3.8

    # We need bash and openssl for Phoenix
    RUN apk upgrade --no-cache &&
    apk add --no-cache bash openssl

    ENV SHELL=/bin/bash

    COPY --from=builder /app/_build/prod/rel/myapp/app

    ENTRYPOINT ["/app/bin/myapp"]

    CMD ["foreground"]


    The error occurs at the second mix do compile



    What cause this to work locally, but fail on Heroku?










    share|improve this question



























      0












      0








      0


      1






      I have a docker file with two stages which successfully builds locally. When I attempt to push it to the heroku's container service it fails to build with an error that a file is not available.



      Error



      ** (Mix.Config.LoadError) could not load config config/prod.exs
      ** (ArgumentError) argument error
      :erlang.binary_to_integer("")
      (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
      (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
      (stdlib) erl_eval.erl:236: :erl_eval.expr/5


      Dockerfile



      FROM bitwalker/alpine-elixir-phoenix:1.5.2 as builder

      ARG CLOAK_ENCRYPTION_KEY
      ARG DATABASE_URL


      ENV MIX_ENV=prod PORT=$PORT DATABASE_URL=$DATABASE_URL CLOAK_ENCRYPTION_KEY=$CLOAK_ENCRYPTION_KEY

      WORKDIR /app

      # Cache elixir deps
      ADD mix.exs mix.lock /app/
      RUN mix do deps.get, deps.compile

      # Same with npm deps
      ADD client/package.json client/package-lock.json /app/client/
      RUN cd client &&
      npm install

      ADD . .

      # Run frontend build, compile, and digest assets
      RUN cd /app/client/ &&
      npm run build &&
      cd /app &&
      mix do compile

      RUN MIX_ENV=prod mix release --env=prod --verbose --no-tar

      ### Release

      FROM alpine:3.8

      # We need bash and openssl for Phoenix
      RUN apk upgrade --no-cache &&
      apk add --no-cache bash openssl

      ENV SHELL=/bin/bash

      COPY --from=builder /app/_build/prod/rel/myapp/app

      ENTRYPOINT ["/app/bin/myapp"]

      CMD ["foreground"]


      The error occurs at the second mix do compile



      What cause this to work locally, but fail on Heroku?










      share|improve this question
















      I have a docker file with two stages which successfully builds locally. When I attempt to push it to the heroku's container service it fails to build with an error that a file is not available.



      Error



      ** (Mix.Config.LoadError) could not load config config/prod.exs
      ** (ArgumentError) argument error
      :erlang.binary_to_integer("")
      (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
      (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
      (stdlib) erl_eval.erl:236: :erl_eval.expr/5


      Dockerfile



      FROM bitwalker/alpine-elixir-phoenix:1.5.2 as builder

      ARG CLOAK_ENCRYPTION_KEY
      ARG DATABASE_URL


      ENV MIX_ENV=prod PORT=$PORT DATABASE_URL=$DATABASE_URL CLOAK_ENCRYPTION_KEY=$CLOAK_ENCRYPTION_KEY

      WORKDIR /app

      # Cache elixir deps
      ADD mix.exs mix.lock /app/
      RUN mix do deps.get, deps.compile

      # Same with npm deps
      ADD client/package.json client/package-lock.json /app/client/
      RUN cd client &&
      npm install

      ADD . .

      # Run frontend build, compile, and digest assets
      RUN cd /app/client/ &&
      npm run build &&
      cd /app &&
      mix do compile

      RUN MIX_ENV=prod mix release --env=prod --verbose --no-tar

      ### Release

      FROM alpine:3.8

      # We need bash and openssl for Phoenix
      RUN apk upgrade --no-cache &&
      apk add --no-cache bash openssl

      ENV SHELL=/bin/bash

      COPY --from=builder /app/_build/prod/rel/myapp/app

      ENTRYPOINT ["/app/bin/myapp"]

      CMD ["foreground"]


      The error occurs at the second mix do compile



      What cause this to work locally, but fail on Heroku?







      heroku elixir dockerfile distillery






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 26 '18 at 14:41







      Justin

















      asked Nov 24 '18 at 15:38









      JustinJustin

      194112




      194112
























          1 Answer
          1






          active

          oldest

          votes


















          2














          Figured it out. When executing the heroku push i was doing an --arg param for each argument (Docker --build-arg is 1 to 1). Heroku actually only wants one --arg with all arguments concatenated with a comma.



          The heroku equivalent of



          docker build -t myapp --build-arg DATABASE_URL=someurl --build-arg CLOAK_ENCRYPTION_KEY=somekey 


          is



          heroku container:push web --arg DATABASE_URL=someurl,CLOAK_ENCRYPTION_KEY=somekey





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459721%2fheroku-container-multi-stage-build-failing-to-find-file%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Figured it out. When executing the heroku push i was doing an --arg param for each argument (Docker --build-arg is 1 to 1). Heroku actually only wants one --arg with all arguments concatenated with a comma.



            The heroku equivalent of



            docker build -t myapp --build-arg DATABASE_URL=someurl --build-arg CLOAK_ENCRYPTION_KEY=somekey 


            is



            heroku container:push web --arg DATABASE_URL=someurl,CLOAK_ENCRYPTION_KEY=somekey





            share|improve this answer




























              2














              Figured it out. When executing the heroku push i was doing an --arg param for each argument (Docker --build-arg is 1 to 1). Heroku actually only wants one --arg with all arguments concatenated with a comma.



              The heroku equivalent of



              docker build -t myapp --build-arg DATABASE_URL=someurl --build-arg CLOAK_ENCRYPTION_KEY=somekey 


              is



              heroku container:push web --arg DATABASE_URL=someurl,CLOAK_ENCRYPTION_KEY=somekey





              share|improve this answer


























                2












                2








                2







                Figured it out. When executing the heroku push i was doing an --arg param for each argument (Docker --build-arg is 1 to 1). Heroku actually only wants one --arg with all arguments concatenated with a comma.



                The heroku equivalent of



                docker build -t myapp --build-arg DATABASE_URL=someurl --build-arg CLOAK_ENCRYPTION_KEY=somekey 


                is



                heroku container:push web --arg DATABASE_URL=someurl,CLOAK_ENCRYPTION_KEY=somekey





                share|improve this answer













                Figured it out. When executing the heroku push i was doing an --arg param for each argument (Docker --build-arg is 1 to 1). Heroku actually only wants one --arg with all arguments concatenated with a comma.



                The heroku equivalent of



                docker build -t myapp --build-arg DATABASE_URL=someurl --build-arg CLOAK_ENCRYPTION_KEY=somekey 


                is



                heroku container:push web --arg DATABASE_URL=someurl,CLOAK_ENCRYPTION_KEY=somekey






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 14:45









                JustinJustin

                194112




                194112






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53459721%2fheroku-container-multi-stage-build-failing-to-find-file%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)