Dockerfile 657 B

123456789101112131415161718192021222324252627282930
  1. # Use Node.js base image for build stage
  2. FROM node:20.12.2 AS build
  3. # Set working directory
  4. WORKDIR /app
  5. # Copy package.json and yarn.lock files
  6. COPY package.json ./
  7. # Install dependencies using Yarn
  8. RUN npm i
  9. # Copy the rest of the application code
  10. COPY . .
  11. # Build the application
  12. RUN npm run build
  13. # Use Nginx base image for final stage
  14. FROM nginx:alpine
  15. # Copy the static files from the SvelteKit app's build output directory into the Nginx server directory
  16. COPY --from=build /app/dist/client /usr/share/nginx/html
  17. COPY nginx.conf /etc/nginx/conf.d/default.conf
  18. # Expose port 80
  19. EXPOSE 80
  20. # Start Nginx server
  21. CMD ["nginx", "-g", "daemon off;"]