Multistage Docker doesn't copy from previous stage

43 views Asked by At

I have a problem with docker multistage. This is my first time making a multistage image and... it's not going well.

When I try to run a container, created with the image, I get the following error:

exec /app/app: no such file or directory

My image is built with the following dockerfile:

FROM python:3.10 AS builder

RUN pip install --upgrade pip
RUN pip install pyinstaller

WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

RUN pyinstaller --onefile --clean --name app --noconfirm app.py

FROM scratch

COPY --from=builder /app/dist/app /app/app

CMD ["/app/app"]

For some strange reason the file copies if I use python slim???

0

There are 0 answers