Question

Problems with Image caching

It seems that app platform has some problems with image caching (?) when building from Dockerfile.

My last deployment was building with two separate stages

FROM node:14-alpine AS builder
# ...
FROM my-app
# ...

The problem is that as soon as I removed the first stage since I don’t need it anymore, the build stopped working and DO seems to be trying to fetch an image called builder from docker hub.

I confirmed this is the problem because now I’m stuck with a Dockerfile that needs an empty FROM node:14-alpine AS builder just to make it work.

Please add an option to clear the cache, otherwise it seems it’s not possible to even change the image I was using as base.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Same issue here, the common theme would be that I am also using node:lts-alpine as a base image, which currently resolves to node:14-alpine.

My issue is a bit deeper, as I had 3 stages, deps, builder, and the final image. Removing deps completely prevents my image from building.

EDIT: Found the issue. It’s probably the same issue as OP, I had a reference to the stage I deleted like so COPY --from=deps whatever whatever/. Marking as resolved.

@WoLfulus 👋

I tried reproducing this with our sample-dockerfile repo.

git clone https://github.com/digitalocean/sample-dockerfile.git
cd sample-dockerfile
doctl app create --spec .do/app.yaml

This creates an app from a multi-stage Dockerfile similar to what you’re describing:

FROM golang:1.12-alpine as builder
WORKDIR /app
COPY . .
RUN go build -mod=vendor -o bin/hello

FROM alpine
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/bin/hello /usr/local/bin/
CMD ["hello"]

Then, updating that to a single stage Dockerfile and redeploying:

git checkout one-stage

Dockerfile:

FROM golang:1.12-alpine
WORKDIR /app
COPY . .
RUN go build -mod=vendor -o bin/hello && \
	cp bin/hello /usr/local/bin/hello
RUN apk --no-cache add ca-certificates
CMD ["hello"]

doctl app update $APP_ID --spec .do/app.yaml

My build + deploy succeeded. Are you able to share more of your dockerfiles or simplified versions that can be used to reproduce?