Files
Frontend/Dockerfile
T

60 lines
1.6 KiB
Docker
Raw Normal View History

2026-05-03 13:43:05 +03:30
ARG DOCKER_REGISTRY_MIRROR=mirror-docker.runflare.com
ARG DEBIAN_MIRROR=mirror-linux.runflare.com/debian
ARG NPM_REGISTRY_MIRROR=https://mirror-npm.runflare.com/
FROM ${DOCKER_REGISTRY_MIRROR}/library/node:20-bookworm-slim AS base
2026-03-21 17:33:39 +03:30
ENV NEXT_TELEMETRY_DISABLED=1
RUN rm -f /etc/apt/sources.list /etc/apt/sources.list.d/* && \
printf '%s\n' \
2026-05-03 13:43:05 +03:30
"deb https://${DEBIAN_MIRROR} bookworm main contrib non-free non-free-firmware" \
"deb https://${DEBIAN_MIRROR} bookworm-updates main contrib non-free non-free-firmware" \
"deb https://mirror-linux.runflare.com/debian-security/ bookworm-security main contrib non-free non-free-firmware" \
2026-03-21 17:33:39 +03:30
> /etc/apt/sources.list
2026-05-03 13:43:05 +03:30
RUN npm config set registry ${NPM_REGISTRY_MIRROR} && \
2026-03-21 17:33:39 +03:30
npm config set strict-ssl false && \
npm config set fetch-retries 5 && \
npm config set fetch-retry-mintimeout 20000
# ---- deps stage ----
FROM base AS deps
2026-02-19 01:15:36 +03:30
WORKDIR /app
2026-03-21 17:33:39 +03:30
COPY package.json package-lock.json ./
2026-04-01 23:02:24 +03:30
2026-04-01 23:12:55 +03:30
RUN npm ci --ignore-scripts
2026-02-19 01:15:36 +03:30
2026-03-21 17:33:39 +03:30
# ---- build stage ----
FROM base AS builder
2026-02-19 01:15:36 +03:30
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
2026-03-21 17:33:39 +03:30
ENV NODE_ENV=production
2026-02-19 01:15:36 +03:30
RUN npm run build
2026-03-21 17:33:39 +03:30
# ---- production stage ----
FROM base AS runner
2026-02-19 01:15:36 +03:30
WORKDIR /app
ENV NODE_ENV=production
2026-03-21 17:39:28 +03:30
ENV PORT=9031
2026-03-21 17:33:39 +03:30
ENV HOSTNAME=0.0.0.0
2026-02-19 01:15:36 +03:30
2026-03-21 17:33:39 +03:30
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
2026-02-19 01:15:36 +03:30
2026-03-21 17:33:39 +03:30
COPY --from=builder /app/public ./public
2026-02-19 01:15:36 +03:30
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
2026-03-21 17:39:28 +03:30
EXPOSE 9031
2026-02-19 01:15:36 +03:30
CMD ["node", "server.js"]