better structuring to docker image building
This commit is contained in:
parent
bfc55293dc
commit
2914be8a88
15 changed files with 80 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
FROM node:lts-bookworm-slim
|
||||
|
||||
ADD resources /tmp
|
||||
RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes /tmp/install.sh
|
||||
RUN /tmp/install.sh
|
|
@ -45,4 +45,4 @@ function checksum() {
|
|||
}
|
||||
|
||||
source /tmp/install_functions.sh
|
||||
main
|
||||
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main
|
|
@ -1,6 +1,6 @@
|
|||
FROM debian:stable-slim
|
||||
|
||||
ADD resources /tmp
|
||||
RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes /tmp/install.sh
|
||||
RUN /tmp/install.sh
|
||||
ENV LANG=en_US.UTF-8 \
|
||||
JAVA_HOME=/usr/lib64/graalvm/graalvm-community-java17
|
|
@ -55,4 +55,4 @@ function checksum() {
|
|||
}
|
||||
|
||||
source /tmp/install_functions.sh
|
||||
main
|
||||
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main
|
|
@ -1,5 +1,5 @@
|
|||
FROM python:3.10-alpine
|
||||
|
||||
WORKDIR /tmp
|
||||
ADD resources ./
|
||||
RUN ./install.sh
|
||||
ADD resources /tmp
|
||||
|
||||
RUN /tmp/install.sh
|
||||
|
|
|
@ -4,14 +4,16 @@ set -exo pipefail
|
|||
|
||||
function main() {
|
||||
{
|
||||
#upgradeSystem
|
||||
apk -U upgrade
|
||||
apk add --no-cache python3 py3-pip openssl-dev bash git curl
|
||||
python3 -m pip install -U pip
|
||||
pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection
|
||||
#cleanupDocker
|
||||
apk cache clean
|
||||
rm -rf /tmp/*
|
||||
} > /dev/null
|
||||
|
||||
rm -rf /tmp/*
|
||||
}
|
||||
|
||||
#source /tmp/install_functions_alpine.sh
|
||||
main
|
||||
|
|
|
@ -4,14 +4,15 @@ set -exo pipefail
|
|||
|
||||
function main() {
|
||||
{
|
||||
#upgradeSystem
|
||||
apk -U upgrade
|
||||
apk add --no-cache python3 py3-pip openssl-dev bash git
|
||||
python3 -m pip install -U pip
|
||||
pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection
|
||||
pip3 --break-system-packages install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection
|
||||
#cleanupDocker
|
||||
apk cache clean
|
||||
rm -rf /tmp/*
|
||||
} > /dev/null
|
||||
|
||||
rm -rf /tmp/*
|
||||
}
|
||||
|
||||
#source /tmp/install_functions_alpine.sh
|
||||
main
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM debian:stable-slim
|
||||
|
||||
ADD resources /tmp
|
||||
RUN DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes /tmp/install.sh
|
||||
RUN /tmp/install.sh
|
||||
|
|
|
@ -7,11 +7,11 @@ function main() {
|
|||
|
||||
apt-get -qqy install curl git kotlin gradle iputils-ping ssh python3 python3-pip
|
||||
|
||||
pip3 install pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection --break-system-packages
|
||||
pip3 install --break-system-packages pybuilder 'ddadevops>=4.7.0' deprecation dda-python-terraform boto3 pyyaml inflection
|
||||
|
||||
cleanupDocker
|
||||
} > /dev/null
|
||||
}
|
||||
|
||||
source /tmp/install_functions.sh
|
||||
main
|
||||
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main
|
|
@ -1,5 +1,4 @@
|
|||
FROM python:3.10-alpine
|
||||
|
||||
WORKDIR /tmp
|
||||
ADD resources ./
|
||||
RUN ./install.sh
|
||||
ADD resources /tmp
|
||||
RUN /tmp/install.sh
|
|
@ -4,15 +4,17 @@ set -exo pipefail
|
|||
|
||||
function main() {
|
||||
{
|
||||
#upgradeSystem
|
||||
apk -U upgrade
|
||||
apk add --no-cache build-base rust python3 python3-dev py3-pip py3-setuptools py3-wheel libffi-dev openssl-dev cargo bash git curl
|
||||
python3 -m pip install -U pip
|
||||
pip3 install pybuilder ddadevops deprecation dda-python-terraform boto3 pyyaml inflection \
|
||||
coverage flake8 flake8-polyfill mypy mypy-extensions pycodestyle pyflakes pylint pytest pytest-cov pytest-datafiles types-setuptools types-PyYAML
|
||||
#cleanupDocker
|
||||
apk cache clean
|
||||
rm -rf /tmp/*
|
||||
} > /dev/null
|
||||
|
||||
rm -rf /tmp/*
|
||||
}
|
||||
|
||||
#source /tmp/install_functions_alpine.sh
|
||||
main
|
||||
|
|
|
@ -31,6 +31,12 @@ class ImageBuildService:
|
|||
self.__copy_build_resource_file_from_package__(
|
||||
"image/resources/install_functions.sh", devops
|
||||
)
|
||||
self.__copy_build_resource_file_from_package__(
|
||||
"image/resources/install_functions_debian.sh", devops
|
||||
)
|
||||
self.__copy_build_resource_file_from_package__(
|
||||
"image/resources/install_functions_alpine.sh", devops
|
||||
)
|
||||
|
||||
def __copy_build_resources_from_dir__(self, devops: Devops):
|
||||
image = devops.specialized_builds[BuildType.IMAGE]
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#
|
||||
#deprecated, we recommend to use install_functions_debian.sh instead. We will going to remove install_functions.sh in a future release.
|
||||
#
|
||||
function upgradeSystem() {
|
||||
{
|
||||
apt-get update
|
||||
|
|
21
src/main/resources/docker/image/resources/install_functions_alpine.sh
Executable file
21
src/main/resources/docker/image/resources/install_functions_alpine.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
function upgradeSystem() {
|
||||
apk -U upgrade
|
||||
}
|
||||
|
||||
function cleanupDocker() {
|
||||
rm -f /root/.ssh/authorized_keys
|
||||
rm -f /root/.ssh/authorized_keys2
|
||||
|
||||
apk cache clean
|
||||
|
||||
rm -rf /tmp/*
|
||||
|
||||
find /var/cache -type f -exec rm -rf {} \;
|
||||
find /var/log/ -name '*.log' -exec rm -f {} \;
|
||||
}
|
||||
|
||||
function cleanupAmi() {
|
||||
rm -f /home/ubuntu/.ssh/authorized_keys
|
||||
rm -f /home/ubuntu/.ssh/authorized_keys2
|
||||
cleanupDocker
|
||||
}
|
25
src/main/resources/docker/image/resources/install_functions_debian.sh
Executable file
25
src/main/resources/docker/image/resources/install_functions_debian.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
function upgradeSystem() {
|
||||
apt-get update
|
||||
apt-get -qqy upgrade
|
||||
}
|
||||
|
||||
function cleanupDocker() {
|
||||
rm -f /root/.ssh/authorized_keys
|
||||
rm -f /root/.ssh/authorized_keys2
|
||||
|
||||
apt-get clean
|
||||
apt-get -qqy autoremove --purge
|
||||
apt-get -qqy autoclean
|
||||
rm -rf /var/lib/apt/lists/
|
||||
|
||||
rm -rf /tmp/*
|
||||
|
||||
find /var/cache -type f -exec rm -rf {} \;
|
||||
find /var/log/ -name '*.log' -exec rm -f {} \;
|
||||
}
|
||||
|
||||
function cleanupAmi() {
|
||||
rm -f /home/ubuntu/.ssh/authorized_keys
|
||||
rm -f /home/ubuntu/.ssh/authorized_keys2
|
||||
cleanupDocker
|
||||
}
|
Loading…
Reference in a new issue