All checks were successful
Deploy Canina / deploy (push) Successful in 5m39s
- Backend Dockerfile: add chown for node_modules (Prisma permissions fix) - Frontend Dockerfile: add ARG/ENV for NEXT_PUBLIC_API_URL, VITE_API_URL - nginx.conf: template with __PLACEHOLDERS__ for per-env substitution - deploy.yml: SSH keepalive, sudo for VPN - api.ts: dynamic API URL via env vars instead of hardcoded - next.config.ts: rewrite only in development mode - scripts: deploy.sh, compose.stage.yml, compose.prod.yml
38 lines
1.3 KiB
Docker
38 lines
1.3 KiB
Docker
FROM node:20-alpine AS app-builder
|
|
WORKDIR /app
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV NEXT_PUBLIC_API_URL=https://stageapi.canina.ir/api
|
|
COPY frontend/application/package*.json ./
|
|
RUN npm ci --prefer-offline --no-audit
|
|
COPY frontend/application ./
|
|
ARG NEXT_PUBLIC_API_URL
|
|
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
|
RUN npm run build
|
|
|
|
FROM node:20-alpine AS admin-builder
|
|
WORKDIR /app
|
|
ENV VITE_API_URL=https://stageapi.canina.ir/api
|
|
COPY frontend/admin-panel/package*.json ./
|
|
RUN npm ci --prefer-offline --no-audit
|
|
COPY frontend/admin-panel ./
|
|
ARG VITE_API_URL
|
|
ENV VITE_API_URL=$VITE_API_URL
|
|
RUN npm run build
|
|
|
|
FROM node:20-alpine
|
|
RUN addgroup -S nginx 2>/dev/null || true && adduser -S nginx -G nginx 2>/dev/null || true
|
|
RUN mkdir -p /var/log/nginx /var/cache/nginx /run/nginx /etc/nginx/conf.d /etc/nginx/http.d
|
|
COPY --from=nginx:alpine /etc/nginx /etc/nginx
|
|
COPY --from=nginx:alpine /usr/sbin/nginx /usr/sbin/nginx
|
|
COPY --from=nginx:alpine /usr/lib /usr/lib
|
|
COPY --from=nginx:alpine /lib /lib
|
|
RUN chown -R nginx:nginx /var/log/nginx /var/cache/nginx /run/nginx 2>/dev/null || true
|
|
WORKDIR /app
|
|
COPY --from=app-builder /app .
|
|
COPY --from=admin-builder /app/dist ./admin_static
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY nginx.conf /etc/nginx/http.d/default.conf
|
|
|
|
EXPOSE 8080
|
|
CMD ["sh", "-c", "nginx && npm start"]
|