-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (33 loc) · 1.13 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
# Use the official Python 3.12 image from the Docker Hub
FROM python:3.12-slim
# Install dependencies and Poetry
RUN apt-get update && \
apt-get install -y --fix-missing build-essential git && \
pip install --no-cache-dir poetry && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app
# creating the file to write XComs to
RUN mkdir -p /airflow/xcom
RUN echo "" > /airflow/xcom/return.json
# Configure Poetry to not use virtual environments
ENV POETRY_VIRTUALENVS_CREATE=false
# Copy the pyproject.toml and poetry.lock files
COPY pyproject.toml poetry.lock ./
# Install only non-development dependencies
RUN poetry install --without dev --no-root
# Copy the rest of the application code into the container
COPY config.yaml .
COPY src ./src
RUN mkdir artefacts
# Add source directory to python path
ENV PYTHONPATH="${PYTHONPATH}:/app/src"
# Set the environment variable
# config path
ENV CONFIG_PATH=./config.yaml
# log level
ENV LOG_LEVEL=INFO
# MLFlow tracking uri
ENV MLFLOW_TRACKING_URI="http://localhost:5000"
# Run the application
CMD ["poetry", "run", "python", "src/main.py"]