Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (44 loc) · 1.33 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (44 loc) · 1.33 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM python:3.14-slim
ARG BUILD_COMMIT=""
ARG BUILD_VERSION=""
# Set environment variables
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.7.1 \
PIP_PREFER_BINARY=1 \
TZ='Europe/Rome' \
BUILD_COMMIT=${BUILD_COMMIT} \
BUILD_VERSION=${BUILD_VERSION}
WORKDIR /usr/app
# Installiamo solo i pacchetti essenziali
RUN apt-get update && \
apt-get install -y --no-install-recommends \
dnsutils \
sqlite3 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Installiamo poetry
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir poetry && \
poetry config virtualenvs.create false
# Copiamo solo i file necessari per l'installazione delle dipendenze
COPY poetry.lock pyproject.toml ./
# Installiamo le dipendenze
RUN poetry install --only main --no-interaction --no-ansi
# Copiamo il resto del codice
COPY src/ ./
COPY entrypoint.sh ./
COPY dev-tools/ ./dev-tools/
# Setup permissions
RUN chmod +x entrypoint.sh && \
groupadd -g 1000 ilpoastapi && \
useradd -u 1000 -g ilpoastapi -s /bin/bash ilpoastapi && \
chown -R ilpoastapi:ilpoastapi /usr/app && \
chmod -R u+w /usr/app
EXPOSE 5000
USER ilpoastapi
ENTRYPOINT ["./entrypoint.sh"]