25 lines
821 B
Docker
25 lines
821 B
Docker
# Stage1
|
|
FROM python:3.13-slim-bullseye AS builder
|
|
|
|
RUN apt update && apt install -y curl
|
|
RUN curl -sSL https://install.python-poetry.org | python3 -
|
|
ENV PATH="/root/.local/bin:$PATH"
|
|
RUN poetry config virtualenvs.create false
|
|
WORKDIR /app
|
|
COPY pyproject.toml poetry.lock ./
|
|
RUN poetry install --with main
|
|
|
|
# Stage2
|
|
FROM python:3.13-slim-bullseye AS final
|
|
|
|
ENV TZ="Asia/Taipei"
|
|
RUN apt update && apt install -y curl
|
|
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
|
|
WORKDIR /app
|
|
COPY ./translator .
|
|
EXPOSE 8501
|
|
CMD ["python", "-m", "streamlit", "run", "app.py", "--server.port=8501", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]
|
|
|
|
# Build
|
|
# docker build --platform=linux/amd64 -t translator:latest .
|
|
# docker save -o translator.tar translator:latest |