-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
38 lines (28 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
FROM python:3.11-slim-bullseye
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV VIRTUAL_ENV=/opt/venv
# Install apt-utils and other necessary dependencies
RUN apt-get update && apt-get install -y \
apt-utils curl netcat vim gettext python3-venv \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a virtual environment for Python dependencies
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Set the working directory
WORKDIR /telegram_app
# Copy only the requirements file first, before copying the rest of the app
COPY requirements.txt /telegram_app/
# Install Python dependencies in the virtual environment (cached layer)
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Copy the rest of the project files
COPY . /telegram_app/
# Copy entrypoint script and make it executable
COPY .deploy/entrypoint.sh /
RUN chmod +x /entrypoint.sh
# Expose the application port
EXPOSE 8000
# Define entrypoint
ENTRYPOINT ["sh", "/entrypoint.sh"]