-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathDockerfile.aws-secrets
More file actions
38 lines (27 loc) · 1.03 KB
/
Dockerfile.aws-secrets
File metadata and controls
38 lines (27 loc) · 1.03 KB
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
# Use an official Python runtime as a parent image
FROM python:3.11-slim as builder
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set work directory
WORKDIR /server
# Install system dependencies
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY ./server/aws-secrets/requirements.txt /server/
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /server/wheels -r requirements.txt
FROM python:3.11-slim as runner
WORKDIR /server
# Install system dependencies
RUN apt-get update && apt-get install -y netcat-openbsd && rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY --from=builder /server/wheels /server/wheels
COPY --from=builder /server/requirements.txt .
RUN pip install --no-cache /server/wheels/*
RUN pip install uvicorn
# Copy project
COPY ./server/aws-secrets/ /server/
# Expose the port the app runs in
EXPOSE 8000
# Define the command to start the container
CMD uvicorn app.main:app --host 0.0.0.0 --port 8000