generated from 0xBcamp/project-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
31 lines (23 loc) · 880 Bytes
/
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
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8
# Install Rust toolchain
RUN apt-get update && \
apt-get install -y curl && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
export CARGO_HOME=$HOME/.cargo && \
export PATH="$CARGO_HOME/bin:$PATH"
# Set environment variables for writable directories
ENV CARGO_HOME=/app/.cargo
ENV CARGO_TARGET_DIR=/app/target
# Create necessary directories
RUN mkdir -p /app/.cargo /app/target
# Set the working directory to the score directory
WORKDIR /app/score
# Copy the source code and requirements file to the container
COPY score/requirements.txt ./
COPY score/ ./
# Ensure directories are writable
RUN chmod -R 777 /app/.cargo /app/target
# Install dependencies
RUN pip install -r requirements.txt
# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]