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

This commit is contained in:
2026-06-28 22:18:09 +03:30
parent 281af04885
commit 788e804568
+54 -48
View File
@@ -1,49 +1,55 @@
FROM node:20-alpine AS base # ---------- Base ----------
FROM node:18-bookworm-slim AS base
# ENV NPM_CONFIG_REGISTRY=https://mirror-npm.runflare.com ENV NUXT_TELEMETRY_DISABLED=1
RUN apk add --no-cache tzdata # Install timezone and build tools required by sharp/node-gyp
RUN apt-get update && apt-get install -y \
# Set the timezone to Asia/Tehran tzdata \
RUN cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && echo "Asia/Tehran" > /etc/timezone python3 \
make \
FROM base AS deps g++ \
WORKDIR /temp-deps && rm -rf /var/lib/apt/lists/*
COPY package*.json ./
RUN npm install ENV TZ=Asia/Tehran
FROM base AS builder # ---------- Dependencies ----------
WORKDIR /build FROM base AS deps
COPY . ./
COPY --from=deps /temp-deps/node_modules ./node_modules WORKDIR /temp-deps
RUN npm run build
RUN npm install --omit=dev COPY package*.json ./
RUN npm install
FROM base AS runner
WORKDIR /app # ---------- Build ----------
ENV NUXT_TELEMETRY_DISABLED=1 FROM base AS builder
WORKDIR /build
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
RUN chown -R appuser:appgroup /app COPY . .
# COPY --from=builder --chown=appuser:appgroup /build/.nuxt ./.nuxt COPY --from=deps /temp-deps/node_modules ./node_modules
# COPY --from=builder --chown=appuser:appgroup /build/static ./static
# COPY --from=builder --chown=appuser:appgroup /build/package.json ./ RUN npm run build
# COPY --from=builder --chown=appuser:appgroup /build/node_modules/ ./node_modules/
COPY --from=builder --chown=appuser:appgroup /build ./ RUN npm prune --omit=dev
# ---------- Runtime ----------
USER appuser FROM base AS runner
# Set environment variables WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3000 ENV NODE_ENV=production
ENV HOSTNAME="0.0.0.0" ENV HOST=0.0.0.0
ENV PORT=3000
EXPOSE 3000 RUN groupadd -r appgroup && useradd -r -g appgroup appuser
# Start the Nuxt 2 app COPY --from=builder --chown=appuser:appgroup /build .
CMD ["npm", "start"]
USER appuser
EXPOSE 3000
CMD ["npm", "start"]