I’m going through the getting-started tutorial. When I
docker push myusername/getting-started
I see 200+ MM is sent, and then the hub shows
COMPRESSED SIZE
137.73 MB
The “app” folder on my desktop is only 4.5 MB. Why is the pushed image so much larger?
FROM node:12-alpine
RUN apk add --no-cache python2 g++ make
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
each line in this, creates a layer of a docker image, so its starts by downloading node:12-alpine, which is 50mb
then it downloads python and a compiler (no idea how much that is, lets just say +50mb), now totals: 100mb
then it copies the local app folder to the app folder in the container, thats +4.5mb (now: 104,5mb)
then it installs the dependencies of your project (yarn install), lets say that +30mb, now totals 134,5mb