Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# Python 3.10 slim 이미지 기반
FROM python:3.12-slim
# 1. Base image
FROM python:3.12-slim-bullseye

# 시스템 라이브러리 설치
# 2. 시스템 라이브러리 설치
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*

# 작업 디렉토리 설정
WORKDIR /app
# 3. uv 설치
RUN pip install --no-cache-dir uv

# 의존성 파일 복사 및 설치
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 4. 작업 디렉토리 설정
WORKDIR /app

# 전체 서비스 코드 복사
# 5. 소스 코드 복사 및 의존성 설치
COPY pyproject.toml ./
COPY . .
RUN uv pip install --system --upgrade pip setuptools wheel \
&& uv pip install --system .

# Python 환경 설정
# 6. 환경 변수 설정
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1

# Streamlit 포트 노출
EXPOSE 8501
# 7. 포트 설정
ENV STREAMLIT_SERVER_PORT=8501

# Streamlit 실행 명령
CMD ["python", "-c", "from llm_utils.tools import set_gms_server; import os; set_gms_server(os.getenv('DATAHUB_SERVER', 'http://localhost:8080'))"]
CMD ["streamlit", "run", "./interface/streamlit_app.py", "--server.port=8501"]
# 8. 실행 명령
CMD ["lang2sql", "run-streamlit"]
2 changes: 1 addition & 1 deletion cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
명령어 예시: lang2sql --datahub_server http://localhost:8080 --run-streamlit
"""

import os
import logging
import os
import subprocess

import click
Expand Down
21 changes: 13 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
services:
streamlit:
hostname: streamlit
container_name: streamlit
build: .
ports:
- "8501:8501"
Expand All @@ -8,21 +10,24 @@ services:
env_file:
- .env
environment:
- DATABASE_URL=postgresql://postgres:password@db:5432/streamlit_db
- STREAMLIT_SERVER_PORT=8501
- DATABASE_URL=postgresql://pgvector:pgvector@pgvector:5432/streamlit
depends_on:
- db
- pgvector

db:
pgvector:
image: pgvector/pgvector:pg17
container_name: pgvector-db
hostname: pgvector
container_name: pgvector
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: streamlit_db
POSTGRES_USER: pgvector
POSTGRES_PASSWORD: pgvector
POSTGRES_DB: streamlit
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
- ./postgres/schema.sql:/docker-entrypoint-initdb.d/schema.sql

volumes:
pgdata:
pgdata: