FROM ubuntu:24.04

WORKDIR /app

# 시스템 패키지 설치

RUN apt-get update && \
    apt-get install -y software-properties-common && \
    rm -rf /var/lib/apt/lists/*

RUN apt-get update && \
    apt-get install -y \
    curl \
    wget \
    gnupg \
    lsb-release \
    apt-transport-https \
    ca-certificates \
    git \
    build-essential \
    python3 \
    python3-dev \
    python3-pip \
    ffmpeg \
    nodejs \
    nginx \
    chromium \
    chromium-browser \
    certbot \
    python3-certbot-nginx \
    && rm -rf /var/lib/apt/lists/*

RUN apt-get install -y wget
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
    sh -c 'echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
RUN apt update && apt install google-chrome-stable -y

RUN pip install requests cryptography flask flask_cors python-dotenv Pillow --break-system-packages --ignore-installed

# Node.js 및 npm 설치
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs && \
    rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y fonts-noto-cjk\
        ca-certificates fonts-liberation libasound2t64 libatk-bridge2.0-0 libatk1.0-0 \
        libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 \
        libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 \
        libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \
        libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release \
        wget xdg-utils

# 포트 개방
EXPOSE 3000 3001

# 컨테이너 실행 상태 유지
CMD ["tail", "-f", "/dev/null"]
