-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.producer
33 lines (23 loc) · 991 Bytes
/
Dockerfile.producer
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
# Stage for installing requirements
FROM python:3.12-slim as requirements-stage
# Set the working directory for this stage
WORKDIR /tmp
# Install Poetry package manager
RUN pip install poetry
# Copy the poetry configuration files to the temporary directory
COPY ./producer/pyproject.toml ./producer/poetry.lock* /tmp/
# Export the dependencies to a requirements.txt file without including hash values
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# Final stage for running the application
FROM python:3.12-slim
# Set the working directory for this stage
WORKDIR /app
# Copy the requirements.txt file from the requirements-stage to the current directory
COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt
# Install the dependencies from the requirements.txt file
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
# Copy rest of the code
COPY ./producer .
COPY .env .
# Remove venv directory
RUN rm -rf venv