Skip to content

Commit

Permalink
feat: add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tapeds committed Nov 30, 2024
1 parent da778ed commit 4dea10c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM node:20-alpine AS deps

RUN npm install -g pnpm
WORKDIR /app

COPY package.json pnpm-lock.yaml ./

RUN pnpm install --frozen-lockfile
RUN rm -f ~/.npmrc

FROM node:20-alpine AS builder

RUN npm install -g pnpm
WORKDIR /app

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

ARG NODE_ENV
ARG API_URL
ARG SITE_URL

ENV NODE_ENV=$NODE_ENV
ENV NEXT_PUBLIC_API_URL=$API_URL
ENV SITE_URL=$SITE_URL

RUN pnpm build

FROM gcr.io/distroless/nodejs20-debian12 as runner

WORKDIR /app

COPY --from=builder /app/public ./public

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

EXPOSE 3000
ENV HOSTNAME "0.0.0.0"

CMD ["server.js"]

0 comments on commit 4dea10c

Please sign in to comment.