WeServer

Dockerfile tips

  • Listen on 0.0.0.0 and the port you entered when ordering.
  • Use multi-stage builds so the final image only contains what runs.
  • Pin base images (node:22-alpine, not node:latest).
  • Don't bake secrets into the image. Use environment variables instead.
  • Keep memory in mind: your plan's RAM is a hard limit; a process over it is restarted.
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app ./
EXPOSE 3000
CMD ["npm", "start"]