diff --git a/Dockerfile b/Dockerfile index ea3b2a1..f12c31b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,10 @@ # Build stage FROM node:20-slim as base -ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" -RUN corepack enable - WORKDIR /base -COPY package.json pnpm-lock.yaml ./ -RUN pnpm install --frozen-lockfile - -COPY . . -# Development +# Local Development FROM base AS dev ENTRYPOINT [] CMD ["pnpm", "dev:next"] @@ -20,6 +12,13 @@ CMD ["pnpm", "dev:next"] # Production FROM base AS builder +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile + +COPY . . ENV NODE_ENV=production RUN pnpm build diff --git a/docker-compose.yml b/docker-compose.yml index 82e11f3..1389b4b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,7 @@ services: - "MONGODB_URI=mongodb://${MONGO_USER}:${MONGO_PASSWORD}@mongo:27017" volumes: - /base/media + - ./:/base networks: - internal ports: