Vite needs VITE_ZITADEL_ISSUER and VITE_ZITADEL_CLIENT_ID at build time for the frontend bundle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38 lines
1.1 KiB
Docker
38 lines
1.1 KiB
Docker
# Stage 1: Build frontend
|
|
FROM oven/bun:1 AS frontend-build
|
|
WORKDIR /app
|
|
COPY frontend/package.json frontend/bun.lock* ./
|
|
RUN bun install --frozen-lockfile || bun install
|
|
COPY frontend/ .
|
|
ARG VITE_ZITADEL_ISSUER=https://auth.kuns.dev
|
|
ARG VITE_ZITADEL_CLIENT_ID
|
|
ENV VITE_ZITADEL_ISSUER=$VITE_ZITADEL_ISSUER
|
|
ENV VITE_ZITADEL_CLIENT_ID=$VITE_ZITADEL_CLIENT_ID
|
|
RUN bun run build
|
|
|
|
# Stage 2: Build backend
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS backend-build
|
|
WORKDIR /src
|
|
COPY backend/*.csproj .
|
|
RUN dotnet restore
|
|
COPY backend/ .
|
|
RUN dotnet publish -c Release -o /app
|
|
|
|
# Stage 3: Runtime
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
|
RUN apt-get update && apt-get install -y nginx curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
COPY --from=backend-build /app .
|
|
COPY --from=frontend-build /app/dist /var/www/html
|
|
|
|
RUN rm /etc/nginx/sites-enabled/default
|
|
COPY nginx.conf /etc/nginx/sites-enabled/default
|
|
|
|
RUN printf '#!/bin/bash\nnginx &\ncd /app && dotnet backend.dll\n' > /start.sh && chmod +x /start.sh
|
|
|
|
EXPOSE 80
|
|
HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=30s \
|
|
CMD ["curl", "-f", "http://localhost:80/health"]
|
|
CMD ["/bin/bash", "/start.sh"]
|