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. Multi-Stage Dockerfiles

Multi-Stage Dockerfiles

Scheduled Pinned Locked Moved App Packaging & Development
10 Posts 6 Posters 1.6k Views 6 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.
  • KubernetesK Offline
    KubernetesK Offline
    Kubernetes
    App Dev
    wrote on last edited by
    #1

    Dear @staff ,

    I would like to request to accept Multi Stage Dockerfiles for Cloudron packages.

    As at the end only the generated Docker Image is what is relevent, it should be accepted if a Multi Stage Dockerfile has been used to build the Cloudron Package Docker Image.

    IMHO this would speed up package creation a lot.

    Best,
    Mike

    girishG timconsidineT LanhildL 3 Replies Last reply
    5
    • KubernetesK Kubernetes

      Dear @staff ,

      I would like to request to accept Multi Stage Dockerfiles for Cloudron packages.

      As at the end only the generated Docker Image is what is relevent, it should be accepted if a Multi Stage Dockerfile has been used to build the Cloudron Package Docker Image.

      IMHO this would speed up package creation a lot.

      Best,
      Mike

      girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #2

      @Kubernetes should be OK. We tried this out the typebot package and it's been working out OK so far.

      As always, the main thing is that all the images must be pinned to a tag. The primary image should be the Cloudron base image.

      KubernetesK 1 Reply Last reply
      0
      • girishG girish

        @Kubernetes should be OK. We tried this out the typebot package and it's been working out OK so far.

        As always, the main thing is that all the images must be pinned to a tag. The primary image should be the Cloudron base image.

        KubernetesK Offline
        KubernetesK Offline
        Kubernetes
        App Dev
        wrote on last edited by
        #3

        @girish okay, so that means, this example of a Dockerfile would be acceptable?

        FROM node:20-alpine as build-stage
        WORKDIR /app
        COPY package*.json ./
        RUN npm install
        COPY . .
        RUN npm run build
        
        FROM cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4 as production-stage
        WORKDIR /app
        COPY --from=build-stage /app/node_modules ./node_modules
        COPY --from=build-stage /app/package.json ./
        COPY --from=build-stage /app/dist ./dist
        COPY --from=build-stage /app/server.js ./
        COPY --from=build-stage /app/static-server.js ./
        COPY --from=build-stage /app/api ./api
        
        EXPOSE 18966
        
        CMD ["npm", "start"]
        
        1 Reply Last reply
        1
        • KubernetesK Kubernetes

          Dear @staff ,

          I would like to request to accept Multi Stage Dockerfiles for Cloudron packages.

          As at the end only the generated Docker Image is what is relevent, it should be accepted if a Multi Stage Dockerfile has been used to build the Cloudron Package Docker Image.

          IMHO this would speed up package creation a lot.

          Best,
          Mike

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

          @Kubernetes good suggestion šŸ‘
          If I see something interesting to package, but then see it's a multi-stage build, I run a mile on the basis that it will too complex to convert into a single-build model.

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

            @Kubernetes yes, looks good!

            1 Reply Last reply
            1
            • klawitterbK Offline
              klawitterbK Offline
              klawitterb
              wrote on last edited by
              #6

              I’m using multi stage dockerfiles for my projects, works like a charm. Only for final stage I use the cloudron base image.

              1 Reply Last reply
              3
              • KubernetesK Kubernetes

                Dear @staff ,

                I would like to request to accept Multi Stage Dockerfiles for Cloudron packages.

                As at the end only the generated Docker Image is what is relevent, it should be accepted if a Multi Stage Dockerfile has been used to build the Cloudron Package Docker Image.

                IMHO this would speed up package creation a lot.

                Best,
                Mike

                LanhildL Offline
                LanhildL Offline
                Lanhild
                App Dev
                wrote on last edited by
                #7

                @Kubernetes That's what I've done for the GROWI package so far, and apart from the things left to do, it works really well and makes things easier

                1 Reply Last reply
                2
                • L Offline
                  L Offline
                  LoudLemur
                  wrote on last edited by
                  #8

                  From Arya:

                  "Multi-stage Docker files are a way to build Docker images in multiple stages, allowing you to create a more efficient and optimized final image. This is useful because it allows you to separate the build environment from the final runtime environment, removing unnecessary dependencies and reducing image size. This leads to faster build times, less vulnerability to security issues, and easier deployment of the final image."

                  1 Reply Last reply
                  2
                  • LanhildL Offline
                    LanhildL Offline
                    Lanhild
                    App Dev
                    wrote on last edited by
                    #9

                    Bumping again for this one specific topic, using multi-stage Dockerfiles when possible for Cloudron packages makes building time substantially faster.

                    1 Reply Last reply
                    3
                    • girishG Offline
                      girishG Offline
                      girish
                      Staff
                      wrote on last edited by
                      #10

                      @Lanhild yup, we already started using multi-stage builds by now. For app store, you have to pin the images though. Using ":latest" is not good will have to be changed.

                      1 Reply Last reply
                      1
                      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