31 lines
1.2 KiB
Docker
31 lines
1.2 KiB
Docker
# Build stage for Frontend Application
|
|
FROM docker.arvancloud.ir/library/node:22-alpine AS app-builder
|
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.arvancloud.ir/g' /etc/apk/repositories && \
|
|
apk add --no-cache openssl
|
|
WORKDIR /app
|
|
COPY frontend/application/package*.json ./
|
|
RUN npm config set registry https://registry.npmmirror.com && npm install
|
|
COPY frontend/application ./
|
|
RUN npm run build
|
|
|
|
# Build stage for Admin Panel
|
|
FROM docker.arvancloud.ir/library/node:22-alpine AS admin-builder
|
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.arvancloud.ir/g' /etc/apk/repositories && \
|
|
apk add --no-cache openssl
|
|
WORKDIR /app
|
|
COPY frontend/admin-panel/package*.json ./
|
|
RUN npm config set registry https://registry.npmmirror.com && npm install
|
|
COPY frontend/admin-panel ./
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM docker.arvancloud.ir/nginxinc/nginx-unprivileged:alpine
|
|
# No need for apk add here unless needed by nginx, but let's keep it clean
|
|
WORKDIR /usr/share/nginx/html
|
|
COPY --from=app-builder /app/.next ./.next
|
|
COPY --from=app-builder /app/public ./public
|
|
COPY --from=admin-builder /app/dist ./admin
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
EXPOSE 8080
|
|
CMD ["nginx", "-g", "daemon off;"]
|