diff --git a/.vscode/settings.json b/.vscode/settings.json index 91b69b2..ef11067 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,13 +3,13 @@ { "ssh": "Disabled", "previewLimit": 50, - "server": "mic-check-db-1", + "server": "localhost", "port": 5432, "askForPassword": true, "driver": "PostgreSQL", "name": "MicCheck - local", - "database": "micheck", - "username": "micheck" + "database": "miccheck", + "username": "miccheck" } ] } \ No newline at end of file diff --git a/dev-build.sh b/dev-build.sh new file mode 100755 index 0000000..27eee0f --- /dev/null +++ b/dev-build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +build_api() { + echo "Building API..." + dotnet publish "$SCRIPT_DIR/src/api/MicCheck.Api/MicCheck.Api.csproj" -c Release -o "$SCRIPT_DIR/src/api/MicCheck.Api/publish" + docker compose -f "$SCRIPT_DIR/docker-compose.yml" restart api + echo "API done." +} + +build_admin() { + echo "Building admin..." + npm --prefix "$SCRIPT_DIR/src/admin" ci --silent + npm --prefix "$SCRIPT_DIR/src/admin" run build + docker compose -f "$SCRIPT_DIR/docker-compose.yml" restart admin + echo "Admin done." +} + +case "${1:-all}" in + api) build_api ;; + admin) build_admin ;; + all) build_api && build_admin ;; + *) + echo "Usage: $0 [api|admin|all]" + exit 1 + ;; +esac diff --git a/docker-compose.yml b/docker-compose.yml index f55ec41..9d97c89 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,6 +24,8 @@ services: dockerfile: src/api/MicCheck.Api/Dockerfile ports: - "8080:8080" + volumes: + - ./src/api/MicCheck.Api/publish:/app environment: ASPNETCORE_ENVIRONMENT: Development ASPNETCORE_URLS: http://+:8080 @@ -48,6 +50,8 @@ services: dockerfile: Dockerfile ports: - "3000:80" + volumes: + - ./src/admin/dist:/usr/share/nginx/html depends_on: api: condition: service_started diff --git a/src/admin/Dockerfile b/src/admin/Dockerfile index f7dc469..d569864 100644 --- a/src/admin/Dockerfile +++ b/src/admin/Dockerfile @@ -1,19 +1,4 @@ -# ── Stage 1: Build ──────────────────────────────────────────────────────────── -FROM node:20-alpine AS build -WORKDIR /app - -# Install dependencies first (cached layer unless package files change) -COPY package*.json ./ -RUN npm ci - -# Copy source and build -COPY . . -RUN npm run build - -# ── Stage 2: Serve ──────────────────────────────────────────────────────────── -FROM nginx:1.27-alpine AS serve -COPY --from=build /app/dist /usr/share/nginx/html +FROM nginx:1.27-alpine COPY nginx.conf /etc/nginx/conf.d/default.conf - EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] diff --git a/src/admin/public/index.html b/src/admin/index.html similarity index 84% rename from src/admin/public/index.html rename to src/admin/index.html index b654718..2bc7a47 100644 --- a/src/admin/public/index.html +++ b/src/admin/index.html @@ -8,5 +8,6 @@
+