Last active
October 22, 2023 19:44
-
-
Save diegofcornejo/589cb06bce3b11555fb72d0b1cf17034 to your computer and use it in GitHub Desktop.
Dockerize: Build (Vite) React App inside Turborepo and serve on nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build stage | |
| from node:18-alpine3.17 as build | |
| WORKDIR /app | |
| # Copy whole project | |
| COPY ../../ . | |
| # Install dependencies | |
| RUN yarn install | |
| # Change working directory to myapp app | |
| # WORKDIR /app/apps/myapp | |
| # Build app | |
| RUN yarn workspace myapp build | |
| # Check if build was successful | |
| # RUN ls /app/apps/myapp/ | |
| # Production stage | |
| FROM nginx:stable-alpine-slim as production | |
| # Copy build artifacts from build stage | |
| COPY --from=build /app/apps/myapp/dist /usr/share/nginx/html | |
| EXPOSE 80 | |
| CMD ["nginx", "-g", "daemon off;"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment