Skip to content

Beautiful Open-Source Form Builder

1.3 KB
Raw Blame
FROM node:24.22.1-alpine AS javascript-builder
WORKDIR /app

# It's best to add as few files as possible before running the build commands
# as they will be re-run everytime one of those files changes.
#
# It's possible to run npm install with only the package.json and package-lock.json file.

ADD ./client/package.json ./client/package-lock.json ./

# Install git and other necessary build tools
RUN apk add --no-cache git

# Clear npm cache, remove existing node_modules, and install dependencies
RUN npm cache clean --force && \
    rm -rf node_modules && \
    npm ci

# Clean up after npm install to free memory
RUN npm cache clean --force

# Explicitly install the correct version of esbuild
# RUN npm install [email protected]

ADD ./client/ /app/

# Respect this bound through npm's build script; the former nested 8/10 GiB
# overrides exceeded the memory available to shared Docker Desktop builders.
ARG NODE_BUILD_HEAP_MB=4096
ENV NODE_OPTIONS="--max-old-space-size=${NODE_BUILD_HEAP_MB}"
ENV NODE_ENV=production
ENV GENERATE_SOURCEMAP=false
ENV NUXT_TELEMETRY_DISABLED=1
RUN --mount=type=tmpfs,target=/tmp \
    NUXT_BUILD_CONCURRENCY=1 npm run build

FROM node:24.22.1-alpine
WORKDIR /app
COPY --from=javascript-builder /app/.output/ /app/
RUN ls /app/

CMD [ "node", "./server/index.mjs" ]