-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
42 lines (31 loc) · 1.58 KB
/
Dockerfile
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
#Build stage
ARG PYTHON_VERSION=3.10
ARG VARIANT=slim-bookworm
FROM python:${PYTHON_VERSION}-slim-bookworm AS builder
LABEL maintainer="LSEG Developer Relations"
#Copy requirements.txt
COPY requirements.txt .
# ------------ Begin: For run in internal LSEG ZScaler environment ------------
#Image runs internet requests over HTTPS – Install Certs if dev environment
#Add the CA Certificate to the container
#ADD ./ZscalerRootCerttificate.pem /usr/local/share/ca-certificates/ZscalerRootCertificate-2048-SHA256.crt
#RUN chmod 644 /usr/local/share/ca-certificates/ZscalerRootCertificate-2048-SHA256.crt && update-ca-certificates
#ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
# ------------ End: For run in internal LSEG ZScaler environment ------------
#Continue the build where the HTTPS Connections are made
# install dependencies to the local user directory (eg. /root/.local)
#RUN pip install --no-cache-dir --user -r requirements.txt
RUN pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --no-cache-dir --user -r requirements.txt
# Run stage
FROM --platform=linux/amd64 python:${PYTHON_VERSION}-alpine3.20
WORKDIR /app
# Update PATH environment variable + set Python buffer to make Docker print every message instantly.
ENV PATH=/root/.local:$PATH \
PYTHONUNBUFFERED=1\
PYTHONIOENCODING=utf-8\
PYTHONLEGACYWINDOWSSTDIO=utf-8
# copy only the dependencies installation from the 1st stage image
COPY --from=builder /root/.local /root/.local
COPY mrn_console_rto_v2.py .
#Run Python
ENTRYPOINT ["python", "mrn_console_rto_v2.py"]