opencloud icon indicating copy to clipboard operation
opencloud copied to clipboard

Reduce build context

Open butonic opened this issue 3 weeks ago • 2 comments

I saw make -C opencloud dev-docker pull in 11.38GB on my machine ... and on @dragonchasers it was 32GB ... this brings it down to ~413MB:

❯ make -C opencloud dev-docker
make: Verzeichnis „/home/.../Repositories/opencloud/opencloud“ wird betreten
docker build -f docker/Dockerfile.multiarch -t opencloudeu/opencloud:dev ..
[+] Building 43.5s (16/16) FINISHED                                                                                                                                           docker:default
 => [internal] load build definition from Dockerfile.multiarch                                                                                                                          0.0s
 => => transferring dockerfile: 2.20kB                                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/alpine:3.22                                                                                                                          0.4s
 => [internal] load metadata for docker.io/library/golang:alpine3.22                                                                                                                    0.4s
 => [internal] load .dockerignore                                                                                                                                                       0.0s
 => => transferring context: 122B                                                                                                                                                       0.0s
 => [stage-1 1/6] FROM docker.io/library/alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412                                                            0.0s
 => [internal] load build context                                                                                                                                                       2.4s
 => => transferring context: 413.19MB                                                                                                                                                   2.4s
 => [build 1/4] FROM docker.io/library/golang:alpine3.22@sha256:3587db7cc96576822c606d119729370dbf581931c5f43ac6d3fa03ab4ed85a10                                                        0.0s
 => CACHED [build 2/4] RUN apk add bash make git curl gcc musl-dev libc-dev binutils-gold inotify-tools vips-dev                                                                        0.0s
 => CACHED [build 3/4] WORKDIR /build                                                                                                                                                   0.0s
 => [build 4/4] RUN --mount=type=bind,target=/build,rw     --mount=type=cache,target=/go/pkg/mod     --mount=type=cache,target=/root/.cache     GOOS="linux" GOARCH="amd64" ;     mak  40.0s
 => CACHED [stage-1 2/6] RUN apk add --no-cache attr bash ca-certificates curl inotify-tools libc6-compat mailcap tree vips patch &&  echo 'hosts: files dns' >| /etc/nsswitch.conf     0.0s 
 => CACHED [stage-1 3/6] RUN addgroup -g 1000 -S opencloud-group &&   adduser -S --ingroup opencloud-group --uid 1000 opencloud-user --home /var/lib/opencloud                          0.0s 
 => CACHED [stage-1 4/6] RUN mkdir -p /var/lib/opencloud &&  mkdir -p /var/lib/opencloud/web/assets/apps &&  chown -R opencloud-user:opencloud-group /var/lib/opencloud &&  chmod -R 7  0.0s 
 => CACHED [stage-1 5/6] WORKDIR /var/lib/opencloud                                                                                                                                     0.0s 
 => [stage-1 6/6] COPY --from=build /dist/binaries/opencloud-linux-amd64 /usr/bin/opencloud                                                                                             0.1s 
 => exporting to image                                                                                                                                                                  0.4s 
 => => exporting layers                                                                                                                                                                 0.3s
 => => writing image sha256:c2a33bc18738eb07b47417d4e735d22c5ba390e6b8350e488ce2fa10ec3952aa                                                                                            0.0s
 => => naming to docker.io/opencloudeu/opencloud:dev                                                                                                                                    0.0s
make: Verzeichnis „/home/.../Repositories/opencloud/opencloud“ wird verlassen

butonic avatar Dec 05 '25 11:12 butonic

Please make sure that you can still do the dev build with Reva replace

micbar avatar Dec 05 '25 12:12 micbar

The issue with the build context comes from the fact that we want to build opencloud in a go workspace with a replace to a currently checked out reva branch which is located parallel to the opencloud repository. Therefore the build context needs to be one level above the opencloud repository root.

See #1778

micbar avatar Dec 05 '25 12:12 micbar

Ok ... that explains it. I'll clean up my env ...

butonic avatar Dec 05 '25 15:12 butonic