Closed bogdan-pechounov closed 1 year ago
Hi @bogdan-pechounov , I think you may need to change your dockerfile a little bit, you need to copy the dist folder from your builder, not from your context folder, something like this.
FROM node:18-alpine as builder
WORKDIR /app
COPY ["package.json", "package-lock.json*", "./"]
RUN npm i
COPY . .
RUN npm run build
FROM node:18-alpine
WORKDIR /app
RUN npm install --global serve
COPY --from=builder app/dist .
CMD ["serve", "-l", "5173"]
Ah that makes more sense. Thank you. It worked locally because I had a dist folder to see what the files looked like.
Expected behavior
Build images first without checking if folder exists, since the folder "dist" will be created in the first stage of a multi-stage docker build.
Actual behavior
Output from Cloud Build:
Information
I have a multi-stage build to serve static files built from a react app.
It works fine locally but not when deploying to the cloud. I am not sure if the issue is with skaffold or Cloud Build.
Steps to reproduce the behavior
(To reproduce it with Cloud Build, it would creating a repo and setting up a trigger with substitution variables _CLUSTER=autopilot-cluster and _ZONE=us-central1)