Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. Dockerfile with 2 x FROM sources

Dockerfile with 2 x FROM sources

Scheduled Pinned Locked Moved App Packaging & Development
7 Posts 4 Posters 1.4k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine
    App Dev
    wrote on last edited by
    #1

    I've seen a few interesting FOSS apps which in their Dockerfiles have 2 FROM ... statements.
    e.g.

    FROM elixir:1.12-alpine as build
    ...
    ...
    FROM elixir:1.12-alpine
    ...
    ...
    

    Ignoring that these examples are not the Cloudron base images, just wondering how this might be handled in building a Cloudron package. Is it possible ?
    Probably going will turn out to be a dumb question : humour the newbie

    mehdiM 1 Reply Last reply
    0
    • timconsidineT timconsidine

      I've seen a few interesting FOSS apps which in their Dockerfiles have 2 FROM ... statements.
      e.g.

      FROM elixir:1.12-alpine as build
      ...
      ...
      FROM elixir:1.12-alpine
      ...
      ...
      

      Ignoring that these examples are not the Cloudron base images, just wondering how this might be handled in building a Cloudron package. Is it possible ?
      Probably going will turn out to be a dumb question : humour the newbie

      mehdiM Offline
      mehdiM Offline
      mehdi
      App Dev
      wrote on last edited by
      #2

      @timconsidine This is just a Docker syntax that allow you to have a temporary container that does some stuff (usually building things), then you can access files built during previous steps in subsequent ones and add them to your image.

      Basically, it's just a way to simplify cleanup : instead of installing a bunch of tools that you only need during build time, then having to remove them (or worse, leave them in the final image), you can do the build in the temporary container, then import the build results in the final container.

      timconsidineT 1 Reply Last reply
      3
      • mehdiM mehdi

        @timconsidine This is just a Docker syntax that allow you to have a temporary container that does some stuff (usually building things), then you can access files built during previous steps in subsequent ones and add them to your image.

        Basically, it's just a way to simplify cleanup : instead of installing a bunch of tools that you only need during build time, then having to remove them (or worse, leave them in the final image), you can do the build in the temporary container, then import the build results in the final container.

        timconsidineT Offline
        timconsidineT Offline
        timconsidine
        App Dev
        wrote on last edited by timconsidine
        #3

        @mehdi thanks for the explanation 👍
        Maybe I will get brave and try it out on a project

        1 Reply Last reply
        0
        • girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by girish
          #4

          This style is called multistage builds, if you want to search/read more. FWIW, they will work fine on Cloudron, we use standard docker images. That all our apps use cloudron/base:3.2.0 as the base image is only a convention that helps us maintain things more easily. (as in, if each each app package had it's own coding style and convention, it becomes hard for us to navigate the code and update them).

          timconsidineT 1 Reply Last reply
          1
          • girishG girish

            This style is called multistage builds, if you want to search/read more. FWIW, they will work fine on Cloudron, we use standard docker images. That all our apps use cloudron/base:3.2.0 as the base image is only a convention that helps us maintain things more easily. (as in, if each each app package had it's own coding style and convention, it becomes hard for us to navigate the code and update them).

            timconsidineT Offline
            timconsidineT Offline
            timconsidine
            App Dev
            wrote on last edited by
            #5

            @girish thanks, will research and play around a bit

            fbartelsF 1 Reply Last reply
            0
            • timconsidineT timconsidine

              @girish thanks, will research and play around a bit

              fbartelsF Offline
              fbartelsF Offline
              fbartels
              App Dev
              wrote on last edited by
              #6

              @timconsidine Multi stage builds are super easy to use. As long as binaries are compatible, you could even pull binaries from pre existing containers.

              I’m doing the same in https://github.com/fbartels/cloudron-drone-app/blob/master/Dockerfile

              timconsidineT 1 Reply Last reply
              2
              • fbartelsF fbartels

                @timconsidine Multi stage builds are super easy to use. As long as binaries are compatible, you could even pull binaries from pre existing containers.

                I’m doing the same in https://github.com/fbartels/cloudron-drone-app/blob/master/Dockerfile

                timconsidineT Offline
                timconsidineT Offline
                timconsidine
                App Dev
                wrote on last edited by
                #7

                @fbartels thanks, nice example 👍

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Bookmarks
                • Search