-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (41 loc) · 1.39 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Stage 1: Build the application
FROM python:3.11.6 as builder
WORKDIR /app
# Copy only the files needed for installing dependencies
COPY pyproject.toml poetry.lock ./
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y libffi-dev
RUN apt-get install -y libssl-dev
RUN apt-get install build-essential
RUN apt-get install -y cargo
RUN rm -rf /var/lib/apt/lists/*
RUN pip install -U pip setuptools
RUN pip install --upgrade cffi
RUN pip install cryptography
# Install dependencies
RUN pip install --no-cache-dir poetry
RUN poetry install --no-root --no-dev
# Copy the rest of the application code
COPY . .
# Build the application (adjust the command based on your build process)
RUN poetry build
# Stage 2: run image
FROM python:3.11.6
WORKDIR /app
# Copy only the necessary files from the builder stage
COPY --from=builder /app/dist /app/dist
# Copy fortune.json and set environment for it
COPY ./src/scraper/fortune.json /app/dist
ENV FORTUNE_LOCATION=/app/dist/fortune.json
RUN apt-get install -y gcc
# Install only the necessary runtime dependencies
RUN pip install --no-cache-dir /app/dist/*.whl
# Define the command to run your application
CMD ["bot"]
# Install any needed packages specified in requirements.txt
# RUN pip install poetry
# RUN pip install --no-cache-dir -e .
# RUN poetry install
# Define the command to run your application
# CMD ["poetry", "run", "python_docker"]