forked from yezz123/DogeAPI
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (23 loc) · 1.02 KB
/
Dockerfile
File metadata and controls
32 lines (23 loc) · 1.02 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
# Use the specified image as the base
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8
# Install system packages
RUN apt update && apt upgrade -y
RUN apt install -y -q build-essential python3-pip python3-dev
# Update pip and install Python packages
RUN pip3 install -U pip setuptools wheel
RUN pip3 install gunicorn uvloop httptools
# Copy requirements and install Python dependencies
COPY requirements.txt /app/requirements.txt
RUN pip3 install -r /app/requirements.txt
# Copy all the code into /app directory (No volume mount needed)
COPY ./ /app
# Create the directory where the database will be stored and give it the appropriate permissions
RUN mkdir -p /var/run/dogeapi && chown -R 1000:1000 /var/run/dogeapi
# Switch to non-root user
USER 1000
# Define environment variables for logging
ENV ACCESS_LOG=${ACCESS_LOG:-/proc/1/fd/1}
ENV ERROR_LOG=${ERROR_LOG:-/proc/1/fd/2}
EXPOSE 8080
# Define the Uvicorn command to run our application
CMD ["uvicorn", "main:app", "--reload", "--workers", "1", "--host", "0.0.0.0", "--port", "8080"]