Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ttimochan committed Jul 10, 2024
1 parent 3ba32d1 commit 1149404
Showing 1 changed file with 35 additions and 9 deletions.
44 changes: 35 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
# Rebuild the source code only when needed
FROM node:18-alpine
FROM node:20-alpine AS builder

RUN apk add libc6-compat git && \
npm i -g pnpm pm2
RUN apk add --no-cache libc6-compat git
RUN npm i -g pnpm
WORKDIR /app
COPY . .

RUN pnpm install
RUN npm run build

# If using npm comment out above and use below instead
# RUN npm run build

# Production image, copy all the files and run next
FROM node:20-alpine AS runner
WORKDIR /app
RUN git clone https://github.com/ttimochan/kami.git --depth 1 .

ENV NODE_ENV production
ENV BASE_URL=https://www.timochan.cn
ENV BASE_URL=${BASE_URL}
ENV NEXT_PUBLIC_API_URL=${BASE_URL}/api
ENV NEXT_PUBLIC_GATEWAY_URL=${BASE_URL}
RUN node -e "console.log(process.env)" && \
pnpm install && \
npm run build
RUN node -e "console.log(process.env)"
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# You only need to copy next.config.mjs if you are NOT using the default configuration
COPY --from=builder /app/next.config.mjs ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 2323

ENV PORT 2323

CMD echo "Mix Space Web [Kami] Image." && sh
CMD echo "Mix Space Web [Kami] Image." && node server.js

0 comments on commit 1149404

Please sign in to comment.