Docker prod env
This commit is contained in:
parent
3fe67426bb
commit
2538fd39c6
@ -1,8 +1,7 @@
|
|||||||
DATABASE_URL="mysql://root:fbOgZ6Xxn5VXBYihjqygRXyaK6ZUgKL6@learnsteam-db/learnsteam_quiz"
|
DATABASE_URL="mysql://root:fbOgZ6Xxn5VXBYihjqygRXyaK6ZUgKL6@learnsteam-db/learnsteam_quiz"
|
||||||
//DATABASE_URL="mysql://learnsteam:fbOgZ6Xxn5VXBYihjqygRXyaK6ZUgKL6@jongyeob.com/learnsteam_quiz"
|
|
||||||
NEXTAUTH_URL=https://learnsteam-quiz.jongyeob.com
|
NEXTAUTH_URL=https://learnsteam-quiz.jongyeob.com
|
||||||
NEXT_PUBLIC_HOST=https://learnsteam-quiz.jongyeob.com
|
NEXT_PUBLIC_HOST=https://learnsteam-quiz.jongyeob.com
|
||||||
NEXT_PUBLIC_API_ENDPOINT=https://learnsteam-quiz-api.jongyeob.com
|
NEXT_PUBLIC_API_ENDPOINT=https://learnsteam-quiz.jongyeob.com
|
||||||
NEXTAUTH_SECRET=dd87d8220ed9535d3152910f62ca40fb8ae292ac527e9528425118406aebbce0
|
NEXTAUTH_SECRET=dd87d8220ed9535d3152910f62ca40fb8ae292ac527e9528425118406aebbce0
|
||||||
|
|
||||||
KAKAO_CLIENT_ID=14f63a8e91c4e0fe88bc40e3ff348233
|
KAKAO_CLIENT_ID=14f63a8e91c4e0fe88bc40e3ff348233
|
@ -1,22 +1,30 @@
|
|||||||
FROM node:alpine AS base
|
FROM node:21-alpine AS base
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN apk update && apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json ./
|
COPY package.json yarn.lock ./
|
||||||
RUN npm install
|
ENV NEXT_TELEMETRY_DISABLED 0
|
||||||
|
RUN yarn --frozen-lockfile
|
||||||
|
|
||||||
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY .env.prod.sample .env.production
|
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
COPY .env.prod.sample .env
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED 0
|
||||||
|
RUN yarn upgrade
|
||||||
RUN npx prisma generate
|
RUN npx prisma generate
|
||||||
RUN npm run build
|
RUN yarn build
|
||||||
|
RUN npm prune --production
|
||||||
|
COPY ./script/start.sh .
|
||||||
|
RUN chmod +x start.sh
|
||||||
|
|
||||||
FROM alpine AS runner
|
FROM alpine AS runner
|
||||||
RUN apk add --no-cache nodejs
|
RUN apk add --no-cache nodejs npm
|
||||||
|
RUN npm install npx -g
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
@ -26,9 +34,12 @@ COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
|||||||
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
|
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/start.sh .
|
||||||
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
EXPOSE 3100
|
EXPOSE 3100
|
||||||
ENV PORT 3100
|
ENV PORT 3100
|
||||||
|
|
||||||
CMD ["node", "server.js"]
|
CMD ["sh", "start.sh"]
|
Loading…
Reference in New Issue
Block a user