mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
38 lines
1010 B
Docker
38 lines
1010 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
ARG TURBO_FILTER=@edr/freight-portal
|
|
ARG APP_PATH=apps/edr-freight-web/portal
|
|
ARG VITE_API_URL=http://localhost:3001/api
|
|
|
|
FROM node:24.15.0-alpine AS base
|
|
RUN apk add --no-cache libc6-compat
|
|
RUN corepack enable
|
|
WORKDIR /app
|
|
|
|
FROM base AS pruner
|
|
ARG TURBO_FILTER
|
|
COPY . .
|
|
RUN pnpm dlx turbo prune "${TURBO_FILTER}" --docker
|
|
|
|
FROM base AS installer
|
|
COPY --from=pruner /app/out/json/ .
|
|
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
|
|
RUN --mount=type=secret,id=npmrc,target=./.npmrc,required=false \
|
|
pnpm install --frozen-lockfile
|
|
|
|
FROM base AS builder
|
|
ARG TURBO_FILTER
|
|
ARG APP_PATH
|
|
ARG VITE_API_URL
|
|
ENV VITE_API_URL=${VITE_API_URL}
|
|
COPY --from=installer /app/ .
|
|
COPY --from=pruner /app/out/full/ .
|
|
RUN pnpm turbo build --filter="${TURBO_FILTER}..."
|
|
|
|
FROM nginx:alpine AS runner
|
|
ARG APP_PATH
|
|
COPY infrastructure/nginx/spa.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=builder /app/${APP_PATH}/dist /usr/share/nginx/html
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|