mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 21:21:10 +02:00
✨ feat(skilltree): enable web deployment
Fix Dockerfile to include all required shared packages and add health endpoint for Docker healthcheck. Enable skilltree-web service in docker-compose.macmini.yml.
This commit is contained in:
parent
23a1c5e539
commit
1e025b7e72
3 changed files with 29 additions and 7 deletions
|
|
@ -2,7 +2,7 @@
|
|||
FROM node:20-alpine AS builder
|
||||
|
||||
# Build arguments for SvelteKit static env vars
|
||||
ARG PUBLIC_BACKEND_URL=http://skilltree-backend:3024
|
||||
ARG PUBLIC_BACKEND_URL=http://skilltree-backend:3038
|
||||
ARG PUBLIC_MANA_CORE_AUTH_URL=http://mana-core-auth:3001
|
||||
|
||||
# Set as environment variables for build
|
||||
|
|
@ -20,9 +20,17 @@ COPY package.json ./
|
|||
COPY pnpm-lock.yaml ./
|
||||
|
||||
# Copy shared packages needed by skilltree web
|
||||
COPY packages/shared-types ./packages/shared-types
|
||||
COPY packages/shared-auth ./packages/shared-auth
|
||||
COPY packages/shared-auth-ui ./packages/shared-auth-ui
|
||||
COPY packages/shared-branding ./packages/shared-branding
|
||||
COPY packages/shared-i18n ./packages/shared-i18n
|
||||
COPY packages/shared-icons ./packages/shared-icons
|
||||
COPY packages/shared-tailwind ./packages/shared-tailwind
|
||||
COPY packages/shared-theme ./packages/shared-theme
|
||||
COPY packages/shared-utils ./packages/shared-utils
|
||||
COPY packages/shared-vite-config ./packages/shared-vite-config
|
||||
COPY packages/shared-api-client ./packages/shared-api-client
|
||||
|
||||
# Copy skilltree web
|
||||
COPY apps/skilltree/apps/web ./apps/skilltree/apps/web
|
||||
|
|
@ -30,6 +38,13 @@ COPY apps/skilltree/apps/web ./apps/skilltree/apps/web
|
|||
# Install dependencies
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Build shared packages that need building
|
||||
WORKDIR /app/packages/shared-vite-config
|
||||
RUN pnpm build
|
||||
|
||||
WORKDIR /app/packages/shared-auth
|
||||
RUN pnpm build || true
|
||||
|
||||
# Build the web app
|
||||
WORKDIR /app/apps/skilltree/apps/web
|
||||
RUN pnpm exec svelte-kit sync
|
||||
|
|
@ -51,16 +66,16 @@ COPY --from=builder /app/apps/skilltree/apps/web/build ./build
|
|||
COPY --from=builder /app/apps/skilltree/apps/web/package.json ./
|
||||
|
||||
# Expose port
|
||||
EXPOSE 5195
|
||||
EXPOSE 5018
|
||||
|
||||
# Set environment variables
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=5195
|
||||
ENV PORT=5018
|
||||
ENV HOST=0.0.0.0
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:5195/health || exit 1
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:5018/health || exit 1
|
||||
|
||||
# Run the app
|
||||
CMD ["node", "build"]
|
||||
|
|
|
|||
10
apps/skilltree/apps/web/src/routes/health/+server.ts
Normal file
10
apps/skilltree/apps/web/src/routes/health/+server.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
export const GET: RequestHandler = async () => {
|
||||
return json({
|
||||
status: 'ok',
|
||||
service: 'skilltree-web',
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
};
|
||||
|
|
@ -1241,10 +1241,7 @@ services:
|
|||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# NOTE: skilltree-web disabled - Dockerfile needs pnpm deploy fix for shared packages
|
||||
# TODO: Fix Dockerfile similar to mana-search to resolve @manacore/shared-vite-config
|
||||
skilltree-web:
|
||||
profiles: ["disabled"]
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/skilltree/apps/web/Dockerfile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue