-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (33 loc) · 1.03 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
ENV POETRY_HOME="/opt/poetry" \
PATH="/opt/poetry/bin:$PATH" \
POETRY_VIRTUALENVS_CREATE=false
RUN curl -sSL https://install.python-poetry.org | python3 - && \
poetry config virtualenvs.create false
# Copy dependency files
COPY poetry.lock pyproject.toml ./
# Install dependencies as root
RUN poetry install --no-interaction --no-ansi --no-root
# Create non-root user
RUN useradd -m appuser && \
chown -R appuser:appuser /app
# Copy the rest of the application code
COPY --chown=appuser:appuser . .
# 프로젝트 설치
RUN poetry install --no-interaction --no-ansi
# Switch to non-root user
USER appuser
# Expose port for Gradio
EXPOSE 7860
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Run the application with full path to ensure correct Python environment
CMD ["/opt/poetry/bin/poetry", "run", "python", "app.py"]