forked from PureStorage-OpenConnect/pure-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.fa
More file actions
51 lines (44 loc) · 2.03 KB
/
Dockerfile.fa
File metadata and controls
51 lines (44 loc) · 2.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
39
40
41
42
43
44
45
46
47
48
49
50
51
# FROM python:3.9-alpine
FROM python:3.9-slim-buster AS builder
# Application directory
WORKDIR /app
COPY . /app
RUN apt-get update
RUN apt-get install ca-certificates curl openssl -y
COPY apex_ca.crt /usr/local/share/ca-certificates
# COPY apex_ca.crt /etc/ssl/certs/
RUN update-ca-certificates
RUN export SSL_CERT_DIR=/etc/ssl/certs
RUN apt-get install python3-pip git -y
# Application directory
WORKDIR /app
COPY pure_fa_exporter.py requirements.fa.txt /app/
COPY flasharray_collector /app/flasharray_collector
# Install dependencies and WSGI server
# RUN pip install --upgrade pip && \
# pip install --no-cache-dir --upgrade requests && \
# pip install --no-cache-dir -r requirements.fa.txt
RUN python3 -m pip config set global.cert certs/nscacert.pem
RUN python3 -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org --no-cache-dir --upgrade certifi -vvv
RUN python3 -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade pip -vvv
RUN python3 -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org --no-cache-dir --upgrade requests -vvv
# Flask Flask-HTTPAuth prometheus-client purestorage urllib3 gunicorn
RUN python3 -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -vvv -r requirements.fa.txt
# Run as non-root user
RUN addgroup --system app
RUN adduser --system app
USER app
# Configure the image properties
# gunicorn settings: bind any, 2 threads, log to
# stdout/stderr (docker/k8s handles logs), anonymize request URL
# end of log shows request time in seconds and size in bytes
ENV GUNICORN_CMD_ARGS="--bind=0.0.0.0:9491 \
--workers=1 \
--access-logfile=- \
--error-logfile=- \
--log-level debug \
--access-logformat=\"%(t)s %(h)s %(U)s %(l)s %(T)s %(B)s\""
EXPOSE 9491
ENTRYPOINT ["gunicorn", "pure_fa_exporter:app"]
# DOCKER_BUILDKIT=0 docker build -t gcr.io/apexclearing/pure-exporter:v1.2.5-a-apex -f Dockerfile.fa .
# docker run -p 9491:9491 --name pure-exporter-fa gcr.io/apexclearing/pure-exporter:v1.2.5-a-apex