Skip to content

Dockerfile in client - important nuance! If you see an nginx web page instead of React App #20

@hazartilirot

Description

@hazartilirot

In case you're wondering I use the latest version of everything up to date. As an example I wrote my code utilizing async/await, functional component against of class component. The code would be available in one of my repos. I cannot explain the reason causing the behaviour if a previous deployment allowed to use multi stage builds in one file - I had no issues with the previous project. This one is just doesn't want to copy files from the build/ directory and I don't know how to trace a reason. Logs didn't show any sign of an error.

**--from=0** this command says copy artifacts from <dir> to <dir>

FROM node:16.13.1-alpine
WORKDIR /app
COPY ["package*.json", "./"]
RUN npm install
COPY . .
RUN npm run build

FROM nginx:1.21.5-alpine
EXPOSE 3000
COPY --from=0 /app/build /usr/share/nginx/html
COPY ./nginx/default.conf ./etc/nginx/conf.d/default.conf

If you're interested, here is my repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions