fix: backend startup failed

This commit is contained in:
Darkraise
2026-01-31 19:25:24 +07:00
parent 0c58921b52
commit d5d902f584
4 changed files with 19 additions and 8 deletions
+9 -1
View File
@@ -12,7 +12,9 @@ env:
jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
service:
- name: backend
@@ -34,6 +36,10 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:latest
network=host
- name: Log in to Docker Hub
uses: docker/login-action@v3
@@ -67,11 +73,13 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
build-args: |
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
VCS_REF=${{ github.sha }}
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
provenance: false
sbom: false
summary:
needs: build-and-push
+5 -4
View File
@@ -14,7 +14,8 @@ COPY package.json package-lock.json ./
COPY backend/package.json ./backend/
# Install all dependencies for the backend workspace
RUN npm ci --workspace=backend --include-workspace-root
# Use npm ci with frozen lockfile for faster, reproducible builds
RUN npm ci --workspace=backend --include-workspace-root --prefer-offline --no-audit
# Copy backend source code
COPY backend ./backend/
@@ -46,13 +47,13 @@ COPY --from=builder /app/package.json /app/package-lock.json ./
COPY --from=builder /app/backend/package.json ./backend/
# Install production dependencies only for backend workspace
RUN npm ci --workspace=backend --include-workspace-root --omit=dev
RUN npm ci --workspace=backend --include-workspace-root --omit=dev --prefer-offline --no-audit
# Copy built application
COPY --from=builder /app/backend/dist ./backend/dist
# Copy migration files (needed at runtime)
COPY --from=builder /app/backend/src/migrations ./backend/src/migrations
# Copy migration files to dist directory (needed at runtime)
COPY --from=builder /app/backend/src/migrations ./backend/dist/migrations
# Create non-root user
RUN addgroup -g 1001 -S flashpoint && \
+2 -1
View File
@@ -14,7 +14,8 @@ COPY package.json package-lock.json ./
COPY frontend/package.json ./frontend/
# Install dependencies for frontend workspace
RUN npm ci --workspace=frontend --include-workspace-root
# Use npm ci with frozen lockfile for faster, reproducible builds
RUN npm ci --workspace=frontend --include-workspace-root --prefer-offline --no-audit
# Copy frontend source code
COPY frontend ./frontend/
+3 -2
View File
@@ -17,7 +17,8 @@ COPY package.json package-lock.json ./
COPY game-service/package.json ./game-service/
# Install all dependencies for game-service workspace
RUN npm ci --workspace=game-service --include-workspace-root
# Use npm ci with frozen lockfile for faster, reproducible builds
RUN npm ci --workspace=game-service --include-workspace-root --prefer-offline --no-audit
# Copy game-service source code
COPY game-service ./game-service/
@@ -49,7 +50,7 @@ COPY --from=builder /app/package.json /app/package-lock.json ./
COPY --from=builder /app/game-service/package.json ./game-service/
# Install production dependencies only for game-service workspace
RUN npm ci --workspace=game-service --include-workspace-root --omit=dev
RUN npm ci --workspace=game-service --include-workspace-root --omit=dev --prefer-offline --no-audit
# Copy built application
COPY --from=builder /app/game-service/dist ./game-service/dist