old docker
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-06-13 15:55:42 +03:30
parent a700e16fd2
commit 1c35a5923a
2 changed files with 30 additions and 40 deletions
+29 -36
View File
@@ -1,54 +1,47 @@
FROM node:20-alpine AS base
RUN apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime \
&& echo "Asia/Tehran" > /etc/timezone
RUN apk add --no-cache tzdata
# Set the timezone to Asia/Tehran
RUN cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && echo "Asia/Tehran" > /etc/timezone
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json ./
ENV npm_config_fetch_timeout=300000 \
npm_config_fetch_retries=5
RUN npm ci
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
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
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 && 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 ./
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
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
EXPOSE 3000
CMD ["node", "node_modules/nuxt/bin/nuxt.js", "start"]
# Start the Nuxt 2 app
CMD ["npm", "start"]