chore: migrate build and CI pipeline from npm to bun
This commit is contained in:
1 parent
08ee84e5c9
commit
3b042fa4f5
2 files changed
+19
-19
No files matched your search
+10
-10
@@ -1,4 +1,4 @@
|
||||
image: node:20
|
||||
image: oven/bun:latest
|
||||
|
||||
stages:
|
||||
- validate
|
||||
@@ -14,13 +14,13 @@ variables:
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- package-lock.json
|
||||
- bun.lockb
|
||||
paths:
|
||||
- .npm/
|
||||
- .bun/
|
||||
|
||||
.node_setup:
|
||||
before_script:
|
||||
- npm ci --cache .npm --prefer-offline
|
||||
- bun install --frozen-lockfile
|
||||
|
||||
# -- Validate Stage --
|
||||
|
||||
@@ -28,19 +28,19 @@ lint:
|
||||
extends: .node_setup
|
||||
stage: validate
|
||||
script:
|
||||
- npx eslint "src/**/*.ts"
|
||||
- bunx eslint "src/**/*.ts"
|
||||
|
||||
prettier:
|
||||
extends: .node_setup
|
||||
stage: validate
|
||||
script:
|
||||
- npx prettier --check "src/**/*.{ts,html,scss,css,json}"
|
||||
- bunx prettier --check "src/**/*.{ts,html,scss,css,json}"
|
||||
|
||||
type-check:
|
||||
extends: .node_setup
|
||||
stage: validate
|
||||
script:
|
||||
- npx tsc --noEmit
|
||||
- bunx tsc --noEmit
|
||||
|
||||
# -- Test Stage --
|
||||
|
||||
@@ -50,11 +50,11 @@ test:
|
||||
- apt-get update && apt-get install -y chromium
|
||||
- echo -e '#!/bin/sh\nexec /usr/bin/chromium --no-sandbox "$@"' > /usr/bin/chromium-no-sandbox
|
||||
- chmod +x /usr/bin/chromium-no-sandbox
|
||||
- npm ci --cache .npm --prefer-offline
|
||||
- bun install --frozen-lockfile
|
||||
variables:
|
||||
CHROME_BIN: /usr/bin/chromium-no-sandbox
|
||||
script:
|
||||
- npm run test -- --watch=false --browsers=ChromeHeadless --code-coverage
|
||||
- bun run test -- --watch=false --browsers=ChromeHeadless --code-coverage
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
@@ -67,7 +67,7 @@ build:
|
||||
extends: .node_setup
|
||||
stage: build
|
||||
script:
|
||||
- npm run build -- --configuration production
|
||||
- bun run build -- --configuration production
|
||||
artifacts:
|
||||
paths:
|
||||
- dist/
|
||||
|
||||
+9
-9
@@ -1,32 +1,32 @@
|
||||
# Stage 1: Build the Angular application
|
||||
FROM node:25-alpine AS builder
|
||||
FROM oven/bun:alpine AS builder
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
COPY package.json bun.lockb* ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci --only=production=false
|
||||
RUN bun install
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the application for production
|
||||
RUN npm run build
|
||||
RUN bun run build
|
||||
|
||||
# Stage 2: Production image
|
||||
FROM node:25-alpine AS production
|
||||
FROM oven/bun:alpine AS production
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
COPY package.json bun.lockb* ./
|
||||
|
||||
# Install only production dependencies
|
||||
RUN npm ci --only=production && npm cache clean --force
|
||||
RUN bun install --production
|
||||
|
||||
# Copy built application from builder stage
|
||||
COPY --from=builder /app/dist ./dist
|
||||
@@ -39,7 +39,7 @@ EXPOSE 4000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:4000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
|
||||
CMD bun -e "require('http').get('http://localhost:4000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "dist/vac-optimizer/server/server.mjs"]
|
||||
CMD ["bun", "run", "dist/vac-optimizer/server/server.mjs"]
|
||||
Reference in new issue
Block a user