Initial Commit
This commit is contained in:
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# Use the official Bun image
|
||||
FROM oven/bun:1-alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies first (better caching)
|
||||
COPY package.json bun.lockb* ./
|
||||
RUN bun install --production
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
# Create non-root user for security
|
||||
RUN addgroup -g 1001 -S nodejs && \
|
||||
adduser -S bunuser -u 1001
|
||||
|
||||
# Change ownership of the app directory
|
||||
RUN chown -R bunuser:nodejs /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER bunuser
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||
CMD bun run --silent healthcheck || exit 1
|
||||
|
||||
# Start the application
|
||||
CMD ["bun", "run", "start"]
|
||||
Reference in New Issue
Block a user