-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile
55 lines (45 loc) · 2.32 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
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM cern/alma9-base:20241101-1.x86_64 as cern
# Do not use python:alpine because of long build time and some bugs
# Production spider uses 3.9
FROM python:3.9-slim
ENV HOME "/home/cmsjobmon"
ENV PATH "${PATH}:/usr/bin/"
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
ENV CONDOR_CONFIG "/dev/null"
ENV REQUESTS_CA_BUNDLE "/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt"
ENV PYTHONPATH "${PYTHONPATH}:/$HOME/cms-htcondor-es/src"
# Add cmsjobmon user and create its home directory
RUN useradd --system --group root --uid 1414 -m -d $HOME -s /bin/bash cmsjobmon
WORKDIR $HOME/cms-htcondor-es
# Install latest kubectl for using with crons
ARG kubectl_stable_version=https://storage.googleapis.com/kubernetes-release/release/stable.txt
# Requiered for CRIC (fetching affiliations)
COPY --from=cern /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
COPY --from=cern /etc/pki/tls/certs/CERN-bundle.pem /etc/pki/tls/certs/CERN-bundle.pem
# ES ca_certs
COPY --from=cern /etc/pki/tls/certs/ca-bundle.trust.crt /etc/pki/tls/certs/ca-bundle.trust.crt
COPY . $HOME/cms-htcondor-es
# Create collectors.json for TEST
RUN mkdir $HOME/.globus && \
mkdir etc && \
echo '{\n\
"Global":["cmsgwms-collector-global.fnal.gov:9620"],\n\
"Volunteer":["vocms0840.cern.ch"],\n\
"ITB":["cmsgwms-collector-itb.cern.ch"]\n\
}\n'> ./etc/collectors.json
# openssl is required for python requirements module. git procps unzip libaio1 wget are exist to be able to debug k8s pod
RUN apt-get update && apt-get install -y bash apt-utils git curl procps unzip libaio1 wget openssl nano jq vim cron && \
chown -R cmsjobmon $HOME && \
python3 -m venv $HOME/cms-htcondor-es/venv3_9 && \
$HOME/cms-htcondor-es/venv3_9/bin/pip install --no-cache-dir -r $HOME/cms-htcondor-es/requirements.txt
USER cmsjobmon
# Docker how to:
# - docker build -t cms-htcondor-es .
# - docker run --name test -it cms-htcondor-es /bin/bash
# - In another shell:
# - docker cp userkey.pem test:/home/cmsjobmon/.globus/
# - docker cp usercert.pem test:/home/cmsjobmon/.globus/
# - docker exec -it --user root test chown -R cmsjobmon /home
# - docker exec -it --user root test cron &
# - Don't forget to create "es.conf" file
# - ctrl-p + ctrl+q sequence keeps container running in background