mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-05-06 20:32:47 +08:00
build(docker): 简化 Dockerfile,移除多阶段构建
This commit is contained in:
24
Dockerfile
24
Dockerfile
@@ -1,29 +1,13 @@
|
|||||||
# Stage 1: Build dependencies
|
|
||||||
FROM python:3.10-slim AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Upgrade pip and setuptools
|
|
||||||
RUN pip install --upgrade pip setuptools
|
|
||||||
|
|
||||||
# Copy and install requirements
|
|
||||||
# This layer is cached and only re-runs when requirements.txt changes
|
|
||||||
COPY ./requirements.txt /app/
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
# Stage 2: Final application image
|
|
||||||
FROM python:3.10-slim
|
FROM python:3.10-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy installed packages from the builder stage
|
# 复制所需文件到容器中
|
||||||
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
COPY ./requirements.txt /app
|
||||||
|
|
||||||
# Copy the application code
|
|
||||||
COPY ./app /app/app
|
|
||||||
COPY ./VERSION /app
|
COPY ./VERSION /app
|
||||||
|
|
||||||
# Set environment variables
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
COPY ./app /app/app
|
||||||
ENV API_KEYS='["your_api_key_1"]'
|
ENV API_KEYS='["your_api_key_1"]'
|
||||||
ENV ALLOWED_TOKENS='["your_token_1"]'
|
ENV ALLOWED_TOKENS='["your_token_1"]'
|
||||||
ENV TZ='Asia/Shanghai'
|
ENV TZ='Asia/Shanghai'
|
||||||
|
|||||||
Reference in New Issue
Block a user