-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathDockerfile.job
More file actions
103 lines (83 loc) · 3.23 KB
/
Dockerfile.job
File metadata and controls
103 lines (83 loc) · 3.23 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
FROM ghcr.io/oracle/oraclelinux:7-slim
# Configure environment
ENV DATASCIENCE_USER datascience
ENV DATASCIENCE_UID 1000
ENV HOME /home/$DATASCIENCE_USER
ENV DATASCIENCE_INSTALL_DIR /etc/datascience
ARG release=19
ARG update=13
RUN \
yum -y -q install oracle-release-el7 && \
yum-config-manager --add-repo http://yum.oracle.com/repo/OracleLinux/OL7/developer_EPEL/x86_64 && \
yum-config-manager --enable ol7_optional_latest --enable ol7_addons --enable ol7_software_collections --enable ol7_oracle_instantclient > /dev/null && \
yum groupinstall -y -q 'Development Tools' && \
yum update -y && \
yum install -y --setopt=skip_missing_names_on_install=False \
bzip2 \
curl \
git \
gcc-gfortran \
libcurl-devel \
libxml2-devel \
oracle-instantclient${release}.${update}-basic \
oracle-instantclient${release}.${update}-sqlplus \
openssl \
openssl-devel \
patch \
sudo \
unzip \
zip \
gcc-c++ \
wget \
gcc \
&& yum clean all \
&& rm -rf /var/cache/yum/*
# setup user
RUN \
mkdir -p /home/$DATASCIENCE_USER && \
useradd -m -s /bin/bash -N -u $DATASCIENCE_UID $DATASCIENCE_USER && \
chown -R $DATASCIENCE_USER /home/$DATASCIENCE_USER && \
chown -R $DATASCIENCE_USER:users /usr/local/ && \
touch /etc/sudoers.d/$DATASCIENCE_USER && echo "$DATASCIENCE_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/$DATASCIENCE_USER && \
mkdir -p $DATASCIENCE_INSTALL_DIR && chown $DATASCIENCE_USER $DATASCIENCE_INSTALL_DIR
RUN mkdir -p /etc/datascience/build
RUN mkdir -p $DATASCIENCE_INSTALL_DIR/{pre-build-ds,post-build-ds,pre-run-ds,pre-run-user}
#conda
# set a default language for localization. necessary for oci cli
ARG LANG=en_US.utf8
ENV LANG=$LANG
ENV SHELL=/bin/bash
# set /opt folder permissions for $DATASCIENCE_USER. Conda is going to live in this folder.
RUN chown -R $DATASCIENCE_USER /opt
USER $DATASCIENCE_USER
WORKDIR /home/datascience
ARG MINIFORGE_URL=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
RUN wget -nv ${MINIFORGE_URL} -O /home/datascience/Miniforge3.sh \
&& /bin/bash /home/datascience/Miniforge3.sh -f -b -p /opt/conda \
&& rm /home/datascience/Miniforge3.sh \
&& /opt/conda/bin/conda clean -yaf
WORKDIR /
USER root
RUN printf "#!/bin/bash\nsource /opt/conda/bin/activate\n" > /etc/profile.d/enableconda.sh \
&& chmod +x /etc/profile.d/enableconda.sh
USER $DATASCIENCE_USER
ENV PATH="/opt/conda/bin:${PATH}"
WORKDIR /home/datascience
COPY docker/base-env.yaml /opt/base-env.yaml
RUN conda env update -q -n root -f /opt/base-env.yaml && conda clean -yaf && rm -rf /home/datascience/.cache/pip
USER $DATASCIENCE_USER
####### WRAP UP ###############################
RUN python -c 'import sys; assert(sys.version_info[:2]) == (3, 8), "Python 3.8 is not detected"'
WORKDIR /
RUN conda list
############# Setup Conda environment tools ###########################
USER root
ARG RAND=1
ARG RUN_WORKING_DIR="/home/datascience"
WORKDIR $RUN_WORKING_DIR
# clean tmp folder
RUN rm -rf /tmp/*
RUN mkdir -p /etc/datascience/operators
USER datascience