This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
node_modules
|
||||
.nuxt
|
||||
.git
|
||||
.github
|
||||
*.md
|
||||
arakrail.archive
|
||||
.env
|
||||
.env.*
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
ecosystem.config.js
|
||||
+26
-30
@@ -4,50 +4,46 @@ RUN ALPINE_VERSION=$(cat /etc/alpine-release | cut -d'.' -f1-2) && \
|
||||
echo "https://linux-mirror.liara.ir/repository/alpine/v${ALPINE_VERSION}/main" > /etc/apk/repositories && \
|
||||
echo "https://linux-mirror.liara.ir/repository/alpine/v${ALPINE_VERSION}/community" >> /etc/apk/repositories
|
||||
|
||||
ENV NPM_CONFIG_REGISTRY=https://package-mirror.liara.ir/repository/npm/
|
||||
|
||||
# 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
|
||||
ENV NPM_CONFIG_REGISTRY=https://package-mirror.liara.ir/repository/npm/ \
|
||||
NUXT_TELEMETRY_DISABLED=1
|
||||
|
||||
FROM base AS deps
|
||||
WORKDIR /temp-deps
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
FROM base AS prod-deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
FROM base AS builder
|
||||
WORKDIR /build
|
||||
COPY . ./
|
||||
COPY --from=deps /temp-deps/node_modules ./node_modules
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
ENV NODE_ENV=production
|
||||
RUN npm run build
|
||||
RUN npm install --omit=dev
|
||||
|
||||
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
ENV NUXT_TELEMETRY_DISABLED=1
|
||||
|
||||
ENV NODE_ENV=production \
|
||||
PORT=6096 \
|
||||
HOSTNAME=0.0.0.0
|
||||
|
||||
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=prod-deps --chown=appuser:appgroup /app/node_modules ./node_modules
|
||||
COPY --from=builder --chown=appuser:appgroup /app/.nuxt ./.nuxt
|
||||
COPY --from=builder --chown=appuser:appgroup /app/static ./static
|
||||
COPY --from=builder --chown=appuser:appgroup /app/package.json ./package.json
|
||||
COPY --from=builder --chown=appuser:appgroup /app/nuxt.config.js ./nuxt.config.js
|
||||
COPY --from=builder --chown=appuser:appgroup /app/api ./api
|
||||
COPY --from=builder --chown=appuser:appgroup /app/store ./store
|
||||
COPY --from=builder --chown=appuser:appgroup /app/middleware ./middleware
|
||||
|
||||
USER appuser
|
||||
|
||||
# Set environment variables
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=6096
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
|
||||
EXPOSE 6096
|
||||
|
||||
# Start the Nuxt 2 app
|
||||
CMD ["npm", "start"]
|
||||
CMD ["node_modules/.bin/nuxt", "start"]
|
||||
|
||||
Reference in New Issue
Block a user