Files
webstudio/fixtures/react-router-docker/Dockerfile
T
Bogdan Chadkin 51ae04c463 experimental: support image processing in docker template (#4762)
Added image a route for image processing in docker template based on ipx
package.

There a few things to note
- it does not have persistent caching and rely only on client cache
control
- performance is not good for remote images
- the package adds 30MB to node_modules, though it will be fixed soon

There is a DOMAINS env variable with comma-separated hosts to restrict
remote images processing similar to netlify and vercel.

Can be tested only locally for now.
2025-01-20 18:55:41 +07:00

24 lines
693 B
Docker

FROM node:22-alpine AS development-dependencies-env
COPY . /app
WORKDIR /app
RUN npm install
FROM node:22-alpine AS production-dependencies-env
COPY ./package.json package-lock.json /app/
WORKDIR /app
RUN npm install --omit=dev
FROM node:22-alpine AS build-env
COPY . /app/
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
WORKDIR /app
RUN npm run build
FROM node:22-alpine
COPY ./package.json package-lock.json /app/
COPY --from=production-dependencies-env /app/node_modules /app/node_modules
COPY --from=build-env /app/build /app/build
WORKDIR /app
# there is a DOMAINS env with comma separated allowed domains for image processing
CMD ["npm", "run", "start"]