-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.dev
32 lines (24 loc) · 1.02 KB
/
Dockerfile.dev
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
# Set the base image from the official Python 3.8 slim image.
FROM python:3.8-slim
# Set environment variables
ENV SERVER_PORT=3000
# Set the working directory inside the container
WORKDIR /app
# Copy the requirements file to the working directory
COPY requirements.txt ./
COPY requirements-dev.txt ./
# Update package lists and install necessary dependencies
RUN apt-get update -y \
&& apt-get install -y curl \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir -r requirements-dev.txt \
&& rm -rf /var/lib/apt/lists/*
# Copy the entire local directory to the working directory
COPY . .
# Expose the container's specified network ports at runtime
EXPOSE $SERVER_PORT
# Healthcheck to verify container is still working
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s \
CMD curl --fail http://localhost:$SERVER_PORT/api/v1/health || exit 1
# Default command to execute when the container starts
CMD uvicorn app.main:app --proxy-headers --host 0.0.0.0 --port $SERVER_PORT