Files
barg-restuarant/Dockerfile
T
morteza 2fa26c4778
deploy to danak / build_and_deploy (push) Has been cancelled
update docker again
2026-06-26 17:58:41 +03:30

58 lines
1.3 KiB
Docker

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
ENV npm_config_nodedir=/usr/local
FROM base AS prod-deps
WORKDIR /deps
RUN apk add --no-cache python3 make g++ vips-dev
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci --omit=dev
FROM base AS builder
WORKDIR /build
RUN apk add --no-cache python3 make g++ vips-dev
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm ci
COPY assets components layouts middleware mixins modules pages plugins server static store nuxt.config.js ./
RUN npm run build
FROM base AS runner
WORKDIR /app
RUN addgroup -S appgroup \
&& adduser -S appuser -G appgroup
ENV NODE_ENV=production \
NUXT_TELEMETRY_DISABLED=1 \
PORT=3000 \
HOSTNAME=0.0.0.0
COPY --from=prod-deps --chown=appuser:appgroup /deps/node_modules ./node_modules
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/server ./server
COPY --from=builder --chown=appuser:appgroup /build/nuxt.config.js /build/package.json ./
USER appuser
EXPOSE 3000
CMD ["node", "node_modules/nuxt/bin/nuxt.js", "start"]