mirror of
https://github.com/tcsenpai/emoji-encoder.git
synced 2025-06-04 09:40:05 +00:00
36 lines
774 B
Docker
36 lines
774 B
Docker
# Base node image
|
|
FROM node:20-alpine AS base
|
|
WORKDIR /app
|
|
|
|
# Dependencies stage
|
|
FROM base AS deps
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Builder stage
|
|
FROM base AS builder
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Runner stage
|
|
FROM base AS runner
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
# Create non-root user
|
|
RUN addgroup --system --gid 1001 nodejs
|
|
RUN adduser --system --uid 1001 nextjs
|
|
|
|
# Copy necessary files and set permissions
|
|
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
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
ENV PORT 3000
|
|
ENV HOSTNAME "0.0.0.0"
|
|
|
|
CMD ["node", "server.js"] |