# syntax=docker/dockerfile:1
# ---------- Dependencies Layer ----------
FROM node:24-slim AS dependencies
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN mkdir -p /tmp/dev /tmp/prod
COPY package.json pnpm-lock.yaml /tmp/dev/
COPY package.json pnpm-lock.yaml /tmp/prod/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
cd /tmp/dev && pnpm install --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
cd /tmp/prod && pnpm install --frozen-lockfile --prod
# ---------- Builder Layer ----------
FROM node:24-slim AS builder
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY --from=dependencies /tmp/dev/node_modules ./node_modules
COPY . .
RUN pnpm run build
# ---------- Runtime Layer ----------
FROM node:24-slim AS runtime
LABEL maintainer="amruthpillai"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.title="Reactive Resume"
LABEL org.opencontainers.image.description="A free and open-source resume builder."
LABEL org.opencontainers.image.vendor="Amruth Pillai"
LABEL org.opencontainers.image.url="https://rxresu.me"
LABEL org.opencontainers.image.documentation="https://docs.rxresu.me"
LABEL org.opencontainers.image.source="https://github.com/amruthpillai/reactive-resume"
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/migrations ./migrations
COPY --from=dependencies /tmp/prod/node_modules ./node_modules
EXPOSE 3000/tcp
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:3000/api/health || exit 1
ENTRYPOINT ["node", ".output/server/index.mjs"]
# Ignore the node_modules directory in the final image builds node_modules # Ignore build outputs *.log *.tmp .dockerignore Dockerfile README.md # OS files .DS_Store */dist */build # pnpm store and lock files are handled in layers, ignore local ones pnpm-lock.yaml pnpm-lock.yaml.bak .cache .artisan
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Use multi-stage build to compile and run Reactive Resume
# Dependencies layer: install dev and prod dependencies separately
FROM node:24-slim AS dependencies
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
# Prepare separate temp directories for dev and prod dependencies
RUN mkdir -p /tmp/dev /tmp/prod
# Install development dependencies
WORKDIR /tmp/dev
COPY package.json pnpm-lock.yaml /tmp/dev/
RUN pnpm install --frozen-lockfile
# Install production dependencies
WORKDIR /tmp/prod
COPY package.json pnpm-lock.yaml /tmp/prod/
RUN pnpm install --frozen-lockfile --prod
# Builder layer: build the application
FROM node:24-slim AS builder
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
# Bring in dependencies built earlier
COPY --from=dependencies /tmp/dev/node_modules ./node_modules
# Copy the rest of the source code
COPY . .
# Build the project
RUN pnpm run build
# Runtime layer: run the built app
FROM node:24-slim AS runtime
LABEL maintainer="amruthpillai"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.title="Reactive Resume"
LABEL org.opencontainers.image.description="A free and open-source resume builder."
LABEL org.opencontainers.image.vendor="Amruth Pillai"
LABEL org.opencontainers.image.url="https://rxresu.me"
LABEL org.opencontainers.image.documentation="https://docs.rxresu.me"
LABEL org.opencontainers.image.source="https://github.com/amruthpillai/reactive-resume"
# Install curl in runtime (as healthcheck uses curl)
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV NODE_ENV=production
# Copy built artifacts and production dependencies
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/migrations ./migrations
COPY --from=dependencies /tmp/prod/node_modules ./node_modules
EXPOSE 3000/tcp
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:3000/api/health || exit 1
ENTRYPOINT ["node", ".output/server/index.mjs"]
# Ignore node_modules in source if you mount from outside node_modules # Logs npm-debug.log yarn-debug.log yarn-error.log # Docker files Dockerfile .dockerignore # Build outputs *.map .output **/.output # PNPM store heavy pnpm-store # Local envs .env* # IDE files *.swp *.swo *.bak *.tmp # Local envs .env*
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Ignore node_modules in source if you mount from outside node_modules # Logs npm-debug.log yarn-debug.log yarn-error.log # Docker files .Dockerfile # Build outputs *.map .output **/.output # PNPM store heavy pnpm-store # Local envs .env* # IDE files *.swp *.swo *.bak *.tmp # Local envs .env*
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# syntax=docker/dockerfile:1
# ---------- Dependencies Layer ----------
FROM node:24-slim AS dependencies
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN mkdir -p /tmp/dev /tmp/prod
COPY package.json pnpm-lock.yaml /tmp/dev/
COPY package.json pnpm-lock.yaml /tmp/prod/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
cd /tmp/dev && pnpm install --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
cd /tmp/prod && pnpm install --frozen-lockfile --prod
# ---------- Builder Layer ----------
FROM node:24-slim AS builder
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY --from=dependencies /tmp/dev/node_modules ./node_modules
COPY . .
RUN pnpm run build
# ---------- Runtime Layer ----------
FROM node:24-slim AS runtime
LABEL maintainer="amruthpillai"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.title="Reactive Resume"
LABEL org.opencontainers.image.description="A free and open-source resume builder."
LABEL org.opencontainers.image.vendor="Amruth Pillai"
LABEL org.opencontainers.image.url="https://rxresu.me"
LABEL org.opencontainers.image.documentation="https://docs.rxresu.me"
LABEL org.opencontainers.image.source="https://github.com/amruthpillai/reactive-resume"
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/migrations ./migrations
COPY --from=dependencies /tmp/prod/node_modules ./node_modules
EXPOSE 3000/tcp
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:3000/api/health || exit 1
ENTRYPOINT ["node", ".output/server/index.mjs"]
# Node modules and build artifacts node_modules/ dist/ build/ .vite/ .cache/ coverage/ .env .env.local .env.* *.log logs/ *.tsbuildinfo .DS_Store .idea/ .vscode/ dist/ *.pem # Docker related files Dockerfile .dockerignore
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# syntax=docker/dockerfile:1
# Note: This Dockerfile avoids BuildKit-specific cache mounts to remain compatible
# with environments that do not enable BuildKit.
# ---------- Dependencies Layer ----------
FROM node:24-slim AS dependencies
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN mkdir -p /tmp/dev /tmp/prod
# Copy lock files first to leverage layer caching on dependencies install
COPY package.json pnpm-lock.yaml /tmp/dev/
COPY package.json pnpm-lock.yaml /tmp/prod/
RUN cd /tmp/dev && pnpm install --frozen-lockfile
RUN cd /tmp/prod && pnpm install --frozen-lockfile --prod
# ---------- Builder Layer ----------
FROM node:24-slim AS builder
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
COPY --from=dependencies /tmp/dev/node_modules ./node_modules
COPY . .
RUN pnpm run build
# ---------- Runtime Layer ----------
FROM node:24-slim AS runtime
LABEL maintainer="amruthpillai"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.title="Reactive Resume"
LABEL org.opencontainers.image.description="A free and open-source resume builder."
LABEL org.opencontainers.image.vendor="Amruth Pillai"
LABEL org.opencontainers.image.url="https://rxresu.me"
LABEL org.opencontainers.image.documentation="https://docs.rxresu.me"
LABEL org.opencontainers.image.source="https://github.com/amruthpillai/reactive-resume"
RUN apt-get update && apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/migrations ./migrations
COPY --from=dependencies /tmp/prod/node_modules ./node_modules
EXPOSE 3000/tcp
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:3000/api/health || exit 1
ENTRYPOINT ["node", ".output/server/index.mjs"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock