mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Update Dockerfile.passenger-web
This commit is contained in:
@@ -10,12 +10,10 @@
|
|||||||
# --build-arg PORT=5174 \
|
# --build-arg PORT=5174 \
|
||||||
# -f infrastructure/docker/Dockerfile.passenger-web .
|
# -f infrastructure/docker/Dockerfile.passenger-web .
|
||||||
#
|
#
|
||||||
|
|
||||||
ARG APP_PACKAGE=@edr/passenger-portal
|
ARG APP_PACKAGE=@edr/passenger-portal
|
||||||
ARG APP_PATH=apps/edr-passenger-web/portal
|
ARG APP_PATH=apps/edr-passenger-web/portal
|
||||||
ARG PORT=5174
|
ARG PORT=5174
|
||||||
ARG NEXT_PUBLIC_API_URL
|
ARG NEXT_PUBLIC_API_URL
|
||||||
|
|
||||||
FROM node:24.15.0-alpine AS base
|
FROM node:24.15.0-alpine AS base
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat
|
||||||
# Store pnpm's content-addressable store under PNPM_HOME so the BuildKit
|
# Store pnpm's content-addressable store under PNPM_HOME so the BuildKit
|
||||||
@@ -24,34 +22,35 @@ ENV PNPM_HOME="/pnpm"
|
|||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
FROM base AS pruner
|
FROM base AS pruner
|
||||||
ARG APP_PACKAGE
|
ARG APP_PACKAGE
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN pnpm dlx turbo prune "${APP_PACKAGE}" --docker
|
RUN pnpm dlx turbo prune "${APP_PACKAGE}" --docker
|
||||||
|
|
||||||
FROM base AS installer
|
FROM base AS installer
|
||||||
COPY --from=pruner /app/out/json/ .
|
COPY --from=pruner /app/out/json/ .
|
||||||
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
|
COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
|
||||||
RUN --mount=type=secret,id=npmrc,target=./.npmrc,required=false \
|
RUN --mount=type=secret,id=npmrc,target=./.npmrc,required=false \
|
||||||
--mount=type=cache,id=pnpm,target=/pnpm/store \
|
--mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
FROM base AS builder
|
FROM base AS builder
|
||||||
ARG APP_PACKAGE
|
ARG APP_PACKAGE
|
||||||
ARG APP_PATH
|
ARG APP_PATH
|
||||||
ARG NEXT_PUBLIC_API_URL
|
ARG NEXT_PUBLIC_API_URL
|
||||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||||
|
|
||||||
|
RUN if [ -z "$NEXT_PUBLIC_API_URL" ]; then \
|
||||||
|
echo "ERROR: NEXT_PUBLIC_API_URL must be set" && \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
COPY --from=installer /app/ .
|
COPY --from=installer /app/ .
|
||||||
COPY --from=pruner /app/out/full/ .
|
COPY --from=pruner /app/out/full/ .
|
||||||
RUN pnpm turbo build --filter="${APP_PACKAGE}..."
|
RUN pnpm turbo build --filter="${APP_PACKAGE}..."
|
||||||
|
|
||||||
FROM base AS deployer
|
FROM base AS deployer
|
||||||
ARG APP_PACKAGE
|
ARG APP_PACKAGE
|
||||||
COPY --from=builder /app/ .
|
COPY --from=builder /app/ .
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
|
||||||
pnpm deploy --filter="${APP_PACKAGE}" --prod --legacy /deploy
|
pnpm deploy --filter="${APP_PACKAGE}" --prod --legacy /deploy
|
||||||
|
|
||||||
FROM node:24.15.0-alpine AS runner
|
FROM node:24.15.0-alpine AS runner
|
||||||
ARG APP_PATH
|
ARG APP_PATH
|
||||||
ARG PORT=5174
|
ARG PORT=5174
|
||||||
|
|||||||
Reference in New Issue
Block a user