This commit is contained in:
@@ -1,2 +1,30 @@
|
|||||||
node_modules
|
node_modules
|
||||||
.nuxt
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
.git
|
||||||
|
.github
|
||||||
|
.gitignore
|
||||||
|
.editorconfig
|
||||||
|
.prettierrc
|
||||||
|
|
||||||
|
README.md
|
||||||
|
docker-compose.yml
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
.idea
|
||||||
|
coverage
|
||||||
|
.cache
|
||||||
|
.nyc_output
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
yarn.lock
|
||||||
|
|||||||
+50
-29
@@ -1,47 +1,68 @@
|
|||||||
|
# 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 /deps
|
||||||
RUN npm install
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
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 /build
|
||||||
|
|
||||||
|
RUN apk add --no-cache python3 make g++ vips-dev
|
||||||
|
|
||||||
|
COPY package.json package-lock.json nuxt.config.js ./
|
||||||
|
COPY assets components layouts middleware mixins modules pages plugins server static store ./
|
||||||
|
|
||||||
|
COPY --from=deps /deps/node_modules ./node_modules
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NUXT_TELEMETRY_DISABLED=1
|
|
||||||
|
|
||||||
|
RUN apk add --no-cache vips \
|
||||||
|
&& addgroup -S appgroup \
|
||||||
|
&& adduser -S appuser -G appgroup
|
||||||
|
|
||||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
ENV NODE_ENV=production \
|
||||||
RUN chown -R appuser:appgroup /app
|
NUXT_TELEMETRY_DISABLED=1 \
|
||||||
|
PORT=3000 \
|
||||||
# COPY --from=builder --chown=appuser:appgroup /build/.nuxt ./.nuxt
|
HOSTNAME=0.0.0.0
|
||||||
# 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=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/modules ./modules
|
||||||
|
COPY --from=builder --chown=appuser:appgroup /build/nuxt.config.js /build/package.json ./
|
||||||
|
|
||||||
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