Skip to content

Commit

Permalink
refactor: overhaul Dockerfile and docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanMorel committed Nov 8, 2023
1 parent adec90a commit 6245650
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 15 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
FROM node:20.1.0-alpine AS base

ARG ENV
WORKDIR /app

RUN npm install -g pnpm
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

WORKDIR /app
RUN npm install -g [email protected]

FROM base AS deps

COPY package.json pnpm-lock.yaml ./

RUN pnpm install --frozen-lockfile --prod

FROM base AS builder

COPY . .
COPY --from=deps /app/node_modules ./node_modules

RUN pnpm ts:check && pnpm build

ENV NODE_ENV production
FROM base AS app

ENV NEXT_TELEMETRY_DISABLED 1
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/public ./public
COPY --from=builder /app/.env ./.env
COPY --from=builder /app/package.json ./package.json

CMD ["pnpm", "start"]
6 changes: 1 addition & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ services:
build:
context: .
dockerfile: Dockerfile
target: base
args:
ENV: ${NODE_ENV}
environment:
DOCKER: "true"
target: app
volumes:
- "./logs:/app/logs"
- "./files:/app/files"
Expand Down

0 comments on commit 6245650

Please sign in to comment.