-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (32 loc) · 1.18 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (32 loc) · 1.18 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
# Dockerfile
# Estágio 1: Imagem base
FROM python:3.10-slim
# Variáveis de ambiente
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Estágio 2: Instalação de dependências
WORKDIR /app
COPY requirements.txt .
# Copy AutoSINAPI toolkit before pip install for local install
COPY ./AutoSINAPI /app/AutoSINAPI
RUN apt-get update && \
apt-get install -y git --no-install-recommends && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AUTOSINAPI=0.1.0 pip install --no-cache-dir ./AutoSINAPI && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Estágio 3: Cópia do código da aplicação
COPY ./api /app/api
# Estágio 4: Segurança e Execução
RUN apt-get update && apt-get install -y wget procps util-linux gdb --no-install-recommends && \
pip install --no-cache-dir py-spy memray && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
useradd -m -u 1000 appuser && \
chown -R appuser:appuser /app
USER appuser
# Expõe a porta que o Uvicorn usará
EXPOSE 8000
# Inicia o servidor Uvicorn
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"]