added nginx #1

Merged
sanjib merged 3 commits from dev into main 2025-02-19 05:27:48 +00:00
3 changed files with 34 additions and 12 deletions
Showing only changes of commit b247985a93 - Show all commits

View file

@ -13,20 +13,25 @@ RUN bun install --frozen-lockfile
# Copy source code # Copy source code
COPY . . COPY . .
# RUN DB Migrations and build # Build the application
RUN bun run db:migrate && bun run build RUN bun run build
# Production stage # Production stage
FROM debian:bookworm-slim # FROM debian:bookworm-slim
WORKDIR /app # WORKDIR /app
# Copy only the compiled binary from builder # # Copy only the compiled binary from builder
COPY --from=builder /app/server . # COPY --from=builder /app/server .
# Expose the port your app runs on # # Expose the port your app runs on
EXPOSE 3000 # EXPOSE 3000
# Run the binary # # Copy the entrypoint script
CMD ["./server"] # 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: ports:
- "${SERVER_PORT}:${SERVER_PORT}" - "${SERVER_PORT}:${SERVER_PORT}"
depends_on: depends_on:
- db db:
- minio condition: service_healthy
minio:
condition: service_healthy
environment: environment:
NODE_ENV: production NODE_ENV: production
DATABASE_URL: ${DATABASE_URL} DATABASE_URL: ${DATABASE_URL}
@ -22,6 +24,12 @@ services:
- "${DB_PORT}:5432" - "${DB_PORT}:5432"
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - 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: minio:
image: minio/minio:latest 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