| 1234567891011121314151617181920212223242526272829 |
- FROM python:3.12-slim
- WORKDIR /app
- ENV POETRY_VIRTUALENVS_CREATE=false \
- PYTHONUNBUFFERED=1 \
- PYTHONDONTWRITEBYTECODE=1
- RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple \
- && pip install --no-cache-dir poetry
- COPY pyproject.toml poetry.lock ./
- RUN poetry source add --priority=primary tsinghua https://pypi.tuna.tsinghua.edu.cn/simple || true \
- && poetry lock \
- && poetry install --no-root --no-interaction --no-ansi
- COPY . .
- # 默认 dev 环境,部署时通过 -e APP_ENV=sit/uat 覆盖
- ARG APP_ENV=dev
- ENV APP_ENV=${APP_ENV}
- ARG GATEWAY_PORT=33333
- ENV GATEWAY_PORT=${GATEWAY_PORT}
- EXPOSE ${GATEWAY_PORT}
- CMD ["sh", "-c", "uvicorn alien_gateway.main:app --host 0.0.0.0 --port ${GATEWAY_PORT}"]
|