React + Docker
Multi-stage Dockerfile: nginx for static sites, a Node server for apps that need one. This page shows exactly what pickstack adds to a React project for Docker: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework react --modules docker --yesCustomize in the configurator
New files
node_modules dist build .output .nuxt .next .svelte-kit .astro .angular .git .env .env.* !.env.example *.log Dockerfile .dockerignore
# syntax=docker/dockerfile:1 FROM node:24-alpine AS build WORKDIR /app COPY package.json package-lock.json* ./ RUN npm install COPY . . RUN npm run build FROM nginx:1.29-alpine COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Hashed file names change with every build, so they can be cached for good.
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
location / {
try_files $uri $uri/ /index.html;
}
}
Project files
.dockerignore.gitignoreDockerfileREADME.mdindex.htmlnginx.confpackage.jsonsrc/App.tsxsrc/components/Counter.tsxsrc/index.csssrc/main.tsxtsconfig.jsonvite.config.ts