29 lines
605 B
Docker
29 lines
605 B
Docker
# syntax = docker/dockerfile:1
|
|
# --- Build Stage ---
|
|
FROM node:20-alpine AS build
|
|
WORKDIR /app
|
|
RUN corepack enable
|
|
|
|
# Copy package.json and lock file, then install dependencies
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install
|
|
|
|
# Copy the rest of the application code and build
|
|
COPY . .
|
|
RUN pnpm build
|
|
|
|
# --- Production Stage ---
|
|
FROM node:20-alpine AS prod
|
|
WORKDIR /app
|
|
|
|
# Only copy the built output from the build stage
|
|
COPY --from=build /app/.output ./
|
|
|
|
# Set environment variables for the server
|
|
ENV PORT=3000
|
|
ENV HOST=0.0.0.0
|
|
EXPOSE $PORT
|
|
|
|
# Start the application
|
|
CMD ["node", "server/index.mjs"]
|