fix: mount /apps and docker socket in PR workflow build-and-deploy-ci job #41
@@ -8,6 +8,7 @@ on:
|
||||
- "Dockerfile.ci-base"
|
||||
- "package.json"
|
||||
- "bun.lock"
|
||||
- "package-lock.json"
|
||||
- ".gitea/workflows/build-ci-images.yml"
|
||||
schedule:
|
||||
# Weekly rebuild to get latest Playwright/Bun versions
|
||||
|
||||
@@ -23,13 +23,13 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --retry 3
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: bun x prisma generate
|
||||
run: npx prisma generate
|
||||
|
||||
- name: Run unit tests
|
||||
run: bun test src/__tests__/unit/ src/__tests__/*.test.tsx src/__tests__/auth-simple.test.ts
|
||||
run: npm test
|
||||
|
||||
build-and-deploy-ci:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -45,10 +45,10 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --retry 3
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Generate Prisma client
|
||||
run: bun x prisma generate
|
||||
run: npx prisma generate
|
||||
env:
|
||||
DATABASE_URL: postgresql://user:pass@localhost:5432/dummy
|
||||
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
exit 1
|
||||
|
||||
- name: Run acceptance tests
|
||||
run: DATABASE_URL="${{ secrets.CI_DATABASE_URL }}" bun test:acceptance
|
||||
run: DATABASE_URL="${{ secrets.CI_DATABASE_URL }}" npx playwright test e2e/
|
||||
env:
|
||||
CI: true
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ jobs:
|
||||
echo "Bumping version: $BUMP"
|
||||
|
||||
# Run the bump script
|
||||
bun run scripts/bump-version.js "$BUMP" --yes
|
||||
node scripts/bump-version.js "$BUMP" --yes
|
||||
|
||||
# Get new version
|
||||
NEW_VERSION=$(bun -e "console.log(require('./package.json').version)")
|
||||
NEW_VERSION=$(node -e "console.log(require('./package.json').version)")
|
||||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "New version: $NEW_VERSION"
|
||||
|
||||
@@ -121,8 +121,9 @@ jobs:
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" \
|
||||
-e NODE_ENV=test \
|
||||
${{ env.IMAGE_NAME }}-test:${{ steps.version.outputs.new_version }} \
|
||||
bun test 'src/__tests__/unit/**' 'src/__tests__/*.test.tsx' 'src/__tests__/auth-simple.test.ts'
|
||||
npm test
|
||||
|
||||
- name: Build production image
|
||||
if: steps.commit.outputs.committed == 'true'
|
||||
|
||||
+11
-11
@@ -4,7 +4,7 @@
|
||||
FROM oven/bun:alpine AS builder
|
||||
|
||||
# Install dependencies (needed for native modules)
|
||||
RUN apk add --no-cache python3 make g++
|
||||
RUN apk add --no-cache python3 make g++ nodejs npm
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
@@ -13,14 +13,14 @@ WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install dependencies (including dev dependencies for building)
|
||||
RUN bun install --retry 3
|
||||
RUN npm ci --legacy-peer-deps
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Generate Prisma client (with dummy PostgreSQL DATABASE_URL for build-time generation)
|
||||
# Note: A dummy URL is used since the real database is not available during build
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" bun x prisma generate
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" npx prisma generate
|
||||
|
||||
# Build the application (with dummy DATABASE_URL for static page generation and git commit)
|
||||
ARG GIT_COMMIT=unknown
|
||||
@@ -30,7 +30,7 @@ RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:
|
||||
FROM oven/bun:alpine AS test-runner
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --no-cache python3 make g++ git
|
||||
RUN apk add --no-cache python3 make g++ git nodejs npm
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
@@ -39,19 +39,19 @@ WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install ALL dependencies (including dev dependencies for testing)
|
||||
RUN bun install --retry 3
|
||||
RUN npm ci --legacy-peer-deps
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Generate Prisma client
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" bun x prisma generate
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" npx prisma generate
|
||||
|
||||
# Stage 3: Production runner
|
||||
FROM oven/bun:alpine AS runner
|
||||
|
||||
# Install dumb-init for proper signal handling
|
||||
RUN apk add --no-cache dumb-init
|
||||
# Install dumb-init and npm for production install
|
||||
RUN apk add --no-cache dumb-init nodejs npm
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup --system --gid 1001 euchre && \
|
||||
@@ -64,15 +64,15 @@ WORKDIR /app
|
||||
COPY --from=builder --chown=euchre:euchre /app/.next ./.next
|
||||
COPY --from=builder --chown=euchre:euchre /app/public ./public
|
||||
COPY --from=builder --chown=euchre:euchre /app/package.json ./package.json
|
||||
COPY --from=builder --chown=euchre:euchre /app/bun.lock ./bun.lock
|
||||
COPY --from=builder --chown=euchre:euchre /app/package-lock.json ./package-lock.json
|
||||
COPY --from=builder --chown=euchre:euchre /app/prisma ./prisma
|
||||
|
||||
# Install only production dependencies
|
||||
RUN bun install --retry 3 --production
|
||||
RUN npm ci --legacy-peer-deps --omit=dev
|
||||
|
||||
# Generate Prisma client
|
||||
# Note: We need to set DATABASE_URL even for generation because prisma.config.ts requires it
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" bun x prisma generate
|
||||
RUN DATABASE_PROVIDER=postgresql DATABASE_URL="postgresql://user:pass@localhost:5432/dummy" npx prisma generate
|
||||
|
||||
# Switch to non-root user
|
||||
USER euchre
|
||||
|
||||
Generated
+10473
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user