This commit is contained in:
Sanjib Kumar Sen 2025-02-19 10:57:22 +06:00
parent 0a2494cd7e
commit b247985a93
3 changed files with 34 additions and 12 deletions

View file

@ -13,20 +13,25 @@ RUN bun install --frozen-lockfile
# Copy source code
COPY . .
# RUN DB Migrations and build
RUN bun run db:migrate && bun run build
# Build the application
RUN bun run build
# Production stage
FROM debian:bookworm-slim
# FROM debian:bookworm-slim
WORKDIR /app
# WORKDIR /app
# Copy only the compiled binary from builder
COPY --from=builder /app/server .
# # Copy only the compiled binary from builder
# COPY --from=builder /app/server .
# Expose the port your app runs on
EXPOSE 3000
# # Expose the port your app runs on
# EXPOSE 3000
# Run the binary
CMD ["./server"]
# # Copy the entrypoint script
# COPY entrypoint.sh .
# Make the entrypoint script executable
RUN chmod +x ./entrypoint.sh
# Set the entrypoint
ENTRYPOINT ["./entrypoint.sh"]

View file

@ -6,8 +6,10 @@ services:
ports:
- "${SERVER_PORT}:${SERVER_PORT}"
depends_on:
- db
- minio
db:
condition: service_healthy
minio:
condition: service_healthy
environment:
NODE_ENV: production
DATABASE_URL: ${DATABASE_URL}
@ -22,6 +24,12 @@ services:
- "${DB_PORT}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
minio:
image: minio/minio:latest

9
entrypoint.sh Normal file
View file

@ -0,0 +1,9 @@
#!/bin/sh
set -e
# Run migrations
bun run db:migrate
# Start the application
echo "Starting the application..."
./server