File size: 1,145 Bytes
2359955 02208da 2359955 02208da 2359955 02208da 2359955 02208da 2359955 02208da 2359955 02208da 2359955 02208da 2359955 02208da 2359955 ecf9cee 2359955 02208da 2359955 35b6412 |
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 |
# Stage 1: Builder
FROM python:3-alpine AS builder
WORKDIR /app
# Create virtual environment and set environment variables
RUN python3 -m venv venv
ENV VIRTUAL_ENV=/app/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Copy all project files to the container
COPY . .
# Install dependencies from requirements.txt
RUN pip install -r requirements.txt
# Stage 2: Runner
FROM python:3-alpine AS runner
WORKDIR /app
# Copy virtual environment from the builder stage
COPY --from=builder /app/venv venv
# Copy all files again (including the ones that may have been modified in the builder stage)
COPY . .
# Set environment variables for the virtual environment
ENV VIRTUAL_ENV=/app/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Ensure that all files and folders have 777 permissions (read, write, and execute)
RUN chmod -R 777 /app
# Create a writable directory for Telethon session files
RUN mkdir -p /app/sessions && chmod -R 777 /app/sessions
# Set environment variable to specify session directory
ENV TELETHON_SESSION_DIR="/app/session"
# Expose the port where the Flask app will be running
EXPOSE 7860
# Run the script
CMD ["python3", "join11.py"]
|