-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile
34 lines (24 loc) · 1.15 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
# Stage 1: Build the environment and install dependencies
FROM condaforge/mambaforge as builder
WORKDIR /app
RUN apt-get update && apt-get install -y gcc python3-dev
# Copy the environment file
COPY refactoring-journey/step13-deployment/app/environment-prod.yml /app/environment-prod.yml
RUN mamba env create -f environment-prod.yml
# Stage 2: Copy necessary artifacts and set up runtime
FROM condaforge/mambaforge
WORKDIR /app
# Copy environment from the builder stage
COPY --from=builder /opt/conda/envs/pop-prod /opt/conda/envs/pop-prod
# Set up environment variables
# Adjusting the path for the model pickle
ARG MODEL_PICKLE_PATH=refactoring-journey/step12-cross-validation/results/models/regression/full/best_model.pickle
ENV MODEL_PATH=/app/best_model.pickle
COPY $MODEL_PICKLE_PATH $MODEL_PATH
# Copying the code and other necessary files from the build context
COPY refactoring-journey/step13-deployment/songpop /app/songpop
COPY refactoring-journey/step13-deployment/app/main.py /app/main.py
# Expose port 80
EXPOSE 80
# Run the FastAPI app using uvicorn
CMD ["mamba", "run", "-n", "pop-prod", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]