sourcecred / widgets

Other
2 stars 3 forks source link

Docker publish --cache-from workaround #25

Closed Beanow closed 5 years ago

Beanow commented 5 years ago

I think it would be cleaner to have this in the orbs job, (https://github.com/CircleCI-Public/docker-orb/issues/15) but here's an alternative approach.

Beanow commented 5 years ago

This shows we should have pretty good results. https://circleci.com/gh/sourcecred/widgets/77

Step 1/8 : FROM node:12
 ---> b18afbdfc458
Step 2/8 : RUN mkdir -p /code
 ---> Using cache
 ---> 8d9f46a980a8
Step 3/8 : WORKDIR /code
 ---> Using cache
 ---> cb66fea59b9f
Step 4/8 : RUN npm install -g yarn@^1.17
 ---> Using cache
 ---> 77235f71a0c2
Step 5/8 : COPY package.json yarn.lock /code/
 ---> Using cache
 ---> 5e1a5ce7a260
Step 6/8 : RUN yarn
 ---> Using cache
 ---> 44eb601cc284
Step 7/8 : COPY . /code
 ---> 8d8a9f6dc520
Step 8/8 : ENTRYPOINT ["/code/bin/contributor-wall-svg.js"]
 ---> Running in d7370c53392a
Removing intermediate container d7370c53392a
 ---> 7eebbba9e873
Successfully built 7eebbba9e873

Interestingly COPY . /code was not cached. Meaning the CircleCI config was copied. This and more can probably be included in .dockerignore for further speedboosts :rocket: