Fixes:
- RowList bug: postgres.js returns array directly, not {rows}. Fix in
buckets.ts, files-ext.ts, multipart.ts (3 files, 8 functions)
- S3 ListBuckets routing: GET / was intercepted by handleHome route
- Presigned URL detection: isS3Request() only checked Authorization header
- FK constraint on bucket delete: cascade-delete files & multipart rows first
- docker-compose.yml: pass S3_ACCESS_KEY / S3_SECRET_KEY to container
- Dockerfile: copy home.html to runner stage for handleHome
Tests:
- test/production-e2e.test.ts: 29 tests (11 Web API + 18 S3 SigV4)
All pass against https://upload.asepharyana.my.id
- Creates and cleans up real buckets/objects on production
33 lines
695 B
Docker
33 lines
695 B
Docker
# Stage 1: Builder
|
|
FROM oven/bun:alpine AS builder
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
# Install dependencies (devDependencies included for build)
|
|
COPY package.json tsconfig.json ./
|
|
RUN bun install
|
|
|
|
# Copy source
|
|
COPY src ./src
|
|
|
|
# Build (lint is run locally before deploy)
|
|
RUN bun run build
|
|
|
|
# Stage 2: Runner
|
|
FROM oven/bun:slim AS runner
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy built files, schema, and package.json
|
|
COPY --from=builder /usr/src/app/dist/index.js ./dist/index.js
|
|
COPY --from=builder /usr/src/app/dist/migrate.js ./dist/migrate.js
|
|
COPY --from=builder /usr/src/app/src/home.html ./home.html
|
|
COPY schema.sql ./
|
|
COPY package.json ./
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Start server
|
|
CMD ["bun", "dist/index.js"]
|