reverse-proxy/Dockerfile

65 lines
1.3 KiB
Text
Raw Permalink Normal View History

2025-06-12 01:33:06 -04:00
# Use official Ubuntu as base image
FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV NODE_ENV=production
# Install system dependencies
RUN apt-get update && apt-get install -y \
nginx \
curl \
wget \
unzip \
openssl \
cron \
supervisor \
&& rm -rf /var/lib/apt/lists/*
# Install Bun
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:$PATH"
# Install acme.sh
RUN curl -fsSL https://get.acme.sh | sh -s email=admin@example.com
ENV PATH="/root/.acme.sh:$PATH"
# Create app directory
WORKDIR /app
# Copy package files
COPY package.json bun.lock ./
# Install dependencies
RUN bun install --production
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p /app/logs /app/data /app/certs /app/nginx
RUN mkdir -p /etc/nginx/conf.d
# Set permissions
RUN chmod +x /app/src/database/init.ts
# Copy nginx configuration
COPY docker/nginx.conf /etc/nginx/nginx.conf
# Copy supervisor configuration
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Create startup script
COPY docker/start.sh /start.sh
RUN chmod +x /start.sh
# Expose ports
EXPOSE 80 443 3000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000/api/health || exit 1
# Start services
CMD ["/start.sh"]