47 lines
1.0 KiB
Docker
47 lines
1.0 KiB
Docker
FROM node:20-alpine AS base
|
|
|
|
ENV NPM_CONFIG_REGISTRY=https://mirror-npm.runflare.com
|
|
ENV TZ=Asia/Tehran
|
|
|
|
RUN apk add --no-cache tzdata
|
|
|
|
FROM base AS deps
|
|
WORKDIR /temp-deps
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
FROM base AS builder
|
|
WORKDIR /build
|
|
COPY . ./
|
|
COPY --from=deps /temp-deps/node_modules ./node_modules
|
|
RUN npm run build
|
|
RUN npm install --omit=dev
|
|
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
ENV NUXT_TELEMETRY_DISABLED=1
|
|
|
|
|
|
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
|
RUN chown -R appuser:appgroup /app
|
|
|
|
# COPY --from=builder --chown=appuser:appgroup /build/.nuxt ./.nuxt
|
|
# COPY --from=builder --chown=appuser:appgroup /build/static ./static
|
|
# COPY --from=builder --chown=appuser:appgroup /build/package.json ./
|
|
# COPY --from=builder --chown=appuser:appgroup /build/node_modules/ ./node_modules/
|
|
COPY --from=builder --chown=appuser:appgroup /build ./
|
|
|
|
|
|
USER appuser
|
|
|
|
# Set environment variables
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
# Start the Nuxt 2 app
|
|
CMD ["npm", "start"] |