-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.in
61 lines (42 loc) · 1.49 KB
/
Dockerfile.in
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
59
60
61
# Stage 1: Build the application
FROM arm32v7/python:3.11.7 as builder
WORKDIR /app
# Copy only the files needed for installing dependencies
COPY pyproject.toml poetry.lock ./
# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
# Set environment variables
ENV PATH="/root/.cargo/bin:${PATH}"
RUN apt-get update
RUN apt-get install -y libffi-dev
RUN apt-get install -y libssl-dev
RUN pip install -U pip setuptools
RUN pip install --upgrade cffi
RUN pip install cryptography
# Install dependencies
RUN pip install --no-cache-dir poetry && \
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: Create a smaller image
FROM arm32v7/python:3.11.7-slim
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
# Install build-essential
RUN apt-get update && apt-get install -y build-essential
# 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"]