@@ -0,0 +1,27 @@
|
|||||||
|
node_modules
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
.git
|
||||||
|
.github
|
||||||
|
.vscode
|
||||||
|
.cursor
|
||||||
|
|
||||||
|
# Logs and caches
|
||||||
|
*.log
|
||||||
|
.npm
|
||||||
|
.cache
|
||||||
|
coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Environment and local config
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
|
||||||
|
# Docker (not needed inside the image)
|
||||||
|
Dockerfile*
|
||||||
|
docker-compose*.yaml
|
||||||
|
docker-compose*.yml
|
||||||
|
|
||||||
|
# Docs
|
||||||
|
README.md
|
||||||
|
*.md
|
||||||
+36
-29
@@ -1,47 +1,54 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
FROM node:20-alpine AS base
|
FROM node:20-alpine AS base
|
||||||
|
|
||||||
RUN apk add --no-cache tzdata
|
RUN apk add --no-cache tzdata \
|
||||||
|
&& cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime \
|
||||||
# Set the timezone to Asia/Tehran
|
&& echo "Asia/Tehran" > /etc/timezone
|
||||||
RUN cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && echo "Asia/Tehran" > /etc/timezone
|
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
WORKDIR /temp-deps
|
|
||||||
COPY package*.json ./
|
WORKDIR /app
|
||||||
RUN npm install
|
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
|
||||||
|
RUN --mount=type=cache,target=/root/.npm \
|
||||||
|
npm ci
|
||||||
|
|
||||||
FROM base AS builder
|
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
|
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json package-lock.json nuxt.config.js ./
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
RUN npm run build \
|
||||||
|
&& npm prune --omit=dev
|
||||||
|
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NUXT_TELEMETRY_DISABLED=1
|
|
||||||
|
|
||||||
|
ENV NODE_ENV=production \
|
||||||
|
NUXT_TELEMETRY_DISABLED=1 \
|
||||||
|
PORT=3000 \
|
||||||
|
HOSTNAME=0.0.0.0
|
||||||
|
|
||||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
RUN addgroup -S appgroup \
|
||||||
RUN chown -R appuser:appgroup /app
|
&& adduser -S appuser -G appgroup
|
||||||
|
|
||||||
# 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 ./
|
|
||||||
|
|
||||||
|
COPY --from=builder --chown=appuser:appgroup /app/package.json ./
|
||||||
|
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
|
||||||
|
COPY --from=builder --chown=appuser:appgroup /app/.nuxt ./.nuxt
|
||||||
|
COPY --from=builder --chown=appuser:appgroup /app/nuxt.config.js ./
|
||||||
|
COPY --from=builder --chown=appuser:appgroup /app/static ./static
|
||||||
|
COPY --from=builder --chown=appuser:appgroup /app/server ./server
|
||||||
|
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
# Set environment variables
|
|
||||||
ENV NODE_ENV=production
|
|
||||||
ENV PORT=3000
|
|
||||||
ENV HOSTNAME="0.0.0.0"
|
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Start the Nuxt 2 app
|
CMD ["node", "node_modules/nuxt/bin/nuxt.js", "start"]
|
||||||
CMD ["npm", "start"]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user