|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
# Use official Bun image with Alpine for smaller size
|
|
|
|
|
FROM oven/bun as base
|
|
|
|
|
# Use standard Bun image for debugging (switch back to alpine later)
|
|
|
|
|
FROM oven/bun:1.1 as base
|
|
|
|
|
|
|
|
|
|
# Install basic debugging tools
|
|
|
|
|
RUN apt-get update && apt-get install -y curl netcat
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install dependencies first (better layer caching)
|
|
|
|
@ -10,12 +13,16 @@ RUN bun install
|
|
|
|
|
COPY src/ ./src/
|
|
|
|
|
COPY index.ts ./
|
|
|
|
|
|
|
|
|
|
# Health check
|
|
|
|
|
# HEALTHCHECK --interval=30s --timeout=3s \
|
|
|
|
|
# CMD curl -f http://localhost:${PORT:-3007}/health || exit 1
|
|
|
|
|
# More forgiving health check during debugging
|
|
|
|
|
HEALTHCHECK --start-period=30s --interval=30s --timeout=3s --retries=3 \
|
|
|
|
|
CMD curl -f http://localhost:${PORT:-3007}/health || exit 0
|
|
|
|
|
|
|
|
|
|
# Server runs on port from environment variable
|
|
|
|
|
EXPOSE ${PORT:-3007}
|
|
|
|
|
|
|
|
|
|
# Start the server
|
|
|
|
|
CMD ["bun", "run", "index.ts"]
|
|
|
|
|
# Make script executable
|
|
|
|
|
COPY startup.sh ./
|
|
|
|
|
RUN chmod +x startup.sh
|
|
|
|
|
|
|
|
|
|
# Start via wrapper script
|
|
|
|
|
CMD ["./startup.sh"]
|
|
|
|
|