Skip to content

Instantly share code, notes, and snippets.

@prabhatthapa
Created September 8, 2025 11:26
Show Gist options
  • Save prabhatthapa/427f863e6acee396e1e98e0776724f28 to your computer and use it in GitHub Desktop.
Save prabhatthapa/427f863e6acee396e1e98e0776724f28 to your computer and use it in GitHub Desktop.
Run NX mono repo app's standalone version via Dockerfile
ARG NODE_VERSION={Add your preferred version number}
ARG ALPINE_VERSION=3.21
ARG APP_NAME
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION}
ARG APP_NAME
ENV APP_NAME=${APP_NAME}
WORKDIR /app
COPY next.config.js package.json pnpm-lock.yaml ./
COPY ./patches ./
COPY .next/standalone/ ./
COPY ./public ./apps/${APP_NAME}/public
COPY .next/static ./apps/${APP_NAME}/public/_next/static
EXPOSE 4200
ENV PORT=4200
ENV HOSTNAME="0.0.0.0"
CMD ["sh", "-c", "node apps/$APP_NAME/server.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment