/
Dockerfile
46 lines (35 loc) · 1.64 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
ARG PYTHON_IMAGE
FROM $PYTHON_IMAGE
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG PYTHON_IMAGE
ARG CPU_ARCHITECTURE
# Install Prerequisites
RUN mkdir -p /usr/share/man/man1 && \
apt-get -y update && \
apt-get install -y wget=1.21* gnupg2=2.2.27* unzip=6.0* git=1:2.30* g++=4:10.2.1* rsync=3.2.* && \
apt-get -y clean
# Install jdk
RUN mkdir -p /etc/apt/keyrings && \
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc && \
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list && \
apt-get -y update && \
apt-get -y install temurin-8-jdk && \
apt-get -y clean
ENV JAVA_HOME=/usr/lib/jvm/temurin-8-jdk-${CPU_ARCHITECTURE}
# Install AWS CLI
RUN wget "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.2.39.zip" -O "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf .aws
# useradd -l is necessary to avoid docker build hanging in export image phase when using large uids
RUN groupadd -g ${GROUP_ID} appuser && \
useradd -rm -l -u ${USER_ID} -d /home/appuser -s /bin/bash -g appuser appuser
COPY cicd/requirements_cicd.lock /tmp/requirements.txt
USER appuser
# install python and configure it for the appuser
RUN python -m pip install --upgrade pip && \
python -m pip install --user -r /tmp/requirements.txt
ENV PATH=/home/appuser/.local/bin:$PATH
RUN mkdir /home/appuser/.ssh/ && touch /home/appuser/.ssh/known_hosts
RUN echo Image built for $CPU_ARCHITECTURE with python image $PYTHON_IMAGE.