Skip to content

Commit

Permalink
fix docker
Browse files Browse the repository at this point in the history
  • Loading branch information
BeautyyuYanli committed Aug 28, 2024
1 parent 0973696 commit d933b23
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
24 changes: 8 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
ARG NOTION_PAGE_ID =
# Install dependencies only when needed
FROM node:14-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# Rebuild the source code only when needed
FROM node:14-alpine AS builder
FROM node:20-slim
RUN apt update && apt install python3 -y && apt clean && npm install -g pnpm
ARG NOTION_PAGE_ID
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN yarn build
RUN rm -rf node_modules
RUN pnpm install --frozen-lockfile && pnpm install sharp
RUN pnpm run build

ENV NODE_ENV production
ENV NODE_ENV=production

EXPOSE 3000

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
# ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_TELEMETRY_DISABLED=1

CMD ["yarn", "start"]
CMD ["pnpm", "run", "start"]
13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.8'

services:
server:
build:
context: .
args:
NOTION_PAGE_ID: your_notion_page_id
restart: always
ports:
- 3000:3000
environment:
NOTION_PAGE_ID: your_notion_page_id

0 comments on commit d933b23

Please sign in to comment.