#5973·sst

Docker Builds taking a millenium

Author: claridgicusCreated Jul 15, 2025Updated Sep 2, 2026

Hola

Recently my experience with deploying my environment has changed - I have a couple docker containers that go out per deploy None of them are overly large in nature

Here's an example docker file

The output of the docker file is an image around 75mb~ and a "cache" image around 900mb

# Stage 1: Install dependencies, only package files to leverage docker cache
FROM node:22-alpine AS dependencies
WORKDIR /app
ENV NODE_OPTIONS=--experimental-require-module 
COPY package*.json ./
RUN npm ci

# Stage 2: Build
FROM node:22-alpine AS build
WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
RUN npm run build

# Stage 3: Production (slim final image)
FROM node:22-alpine AS production
WORKDIR /app

# Copy only built assets and package info for prod install
COPY --from=build /app/dist ./dist
COPY package*.json ./

# Only install production dependencies
RUN npm ci --omit=dev

EXPOSE 3000
CMD ["node", "dist/apps/admin-server/main"]

In watching what's happening it seems to hang pulling/pushing layers to and from ECR

#18 exporting cache to registry
#18 preparing build cache for export
#18 writing layer sha256:18936c1bcccb01547cfbc55e2d4044eaea3ec5ebc1f1e1a96657c4798e45c2fd
#18 writing layer sha256:18936c1bcccb01547cfbc55e2d4044eaea3ec5ebc1f1e1a96657c4798e45c2fd 0.2s done
#18 writing layer sha256:29165e39bcc16adbfb83267369bba1e9b8acf9d4c41a42ba246f7a3f6e1e8d64
#18 writing layer sha256:29165e39bcc16adbfb83267369bba1e9b8acf9d4c41a42ba246f7a3f6e1e8d64 1041.0s done
#18 writing layer sha256:38ecdec9c2b1da12f4a12bb83e1c2b12ae3f47a71355eca613d4150f13ed5eff

at this point I've seen writing a layer take over an hour.

My internet is not the fastest but its not a snail either - should be about 50mbps up

I've tried a small reproduction and a smaller container with a single feature in it - they all suffer from the same problem of being slow to deploy - but the complexity does impact the speed somewhat.