Files
GMW/infra/docker/Dockerfile.backend
T
Developer dcd13482c2
Build & Deploy / build-and-push (backend) (push) Failing after 35s
Build & Deploy / build-and-push (discord-gateway) (push) Failing after 25s
Build & Deploy / build-and-push (proxy) (push) Failing after 25s
refactor: break monorepo into 3 standalone services (gateway, backend, frontend)
- Remove pnpm workspace, moon repo, and all monorepo tooling
- Delete packages/shared/, embed shared code directly into each service
- Copy packages/shared/src/* -> services/backend/src/shared/ and services/discord-gateway/src/shared/
- Replace all @bete/shared imports with @/shared/ path alias
- Remove @bete/shared workspace dependency from both services
- Update root package.json scripts from --filter to --prefix
- Rewrite Dockerfiles to build each service standalone
- Clean up biome.json, .gitignore, remove root drizzle.config.ts
2026-07-30 11:50:48 +07:00

46 lines
1.3 KiB
Docker

FROM node:22-slim
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Install build tools for native dependencies (node-crc, @discordjs/opus)
RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends python3 make g++ wget && rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd --system app && useradd --system -g app app
# Copy dependency definition files first for better caching
COPY services/backend/package.json services/backend/pnpm-lock.yaml* ./services/backend/
# Copy patches (pnpm patchedDependencies)
COPY patches ./patches
# Copy service source (shared code is embedded in src/shared/)
COPY services/backend/ ./services/backend/
# Install dependencies
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
cd services/backend && pnpm install --frozen-lockfile
# Build backend
RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
cd services/backend && pnpm run build
# Own dist + node_modules by non-root user
RUN chown -R app:app /app
# Switch to non-root user
USER app
# Expose port
EXPOSE 3000
# Healthcheck — backend serves HTTP on port 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
CMD wget -qO- http://localhost:3000/api/health || exit 1
# Start backend
CMD ["node", "services/backend/dist/index.js"]