-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
178 lines (162 loc) · 6.54 KB
/
Copy pathDockerfile
File metadata and controls
178 lines (162 loc) · 6.54 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# SPDX-FileCopyrightText: Copyright (C) 2010-2026 Cosmo Tech
# SPDX-License-Identifier: LicenseRef-CosmoTech
FROM debian:trixie as builder
# Avoid prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
# Install the base dependencies for the Cosmo Tech Solution Development Kit (SDK), also known as Cosmo Simulation Suite (CSS)
# as in https://cogit.cosmotech.com/projects/PROD/repos/css/browse/csmPackaging/Dockerfile.base
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
build-essential \
# Cosmo Tech Solution Development Kit (SDK) dependencies
ccache \
libdbus-1-3 \
libegl1 \
libfontconfig1 \
libgbm1 \
libgd3 \
libgl1 \
libglib2.0-0 \
libglx0 \
libnss3 \
libopengl0 \
libsm6 \
libwayland-cursor0 \
libx11-xcb1 \
libxcb-cursor0 \
libxcb-dri3-0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-render0 \
libxcb-shape0 \
libxcb-shm0 \
libxcb-sync1 \
libxcb-xfixes0 \
libxcb-xinerama0 \
libxcb-xkb1 \
libxkbcommon-x11-0 \
libxkbcommon0 \
libxkbfile1 \
python3-dev \
python3-pip \
python3-venv \
zlib1g-dev \
# Additional dependencies for tooling
curl \
wget \
gnupg \
lsb-release \
ca-certificates \
python3.13-venv \
apt-transport-https \
# Clean up
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autopurge -y \
&& apt-get clean
# Install the Cosmo Tech Solution Development Kit (SDK), also known as Cosmo Simulation Suite (CSS)
# as in https://cogit.cosmotech.com/projects/PROD/repos/css/browse/csmPackaging/Dockerfile.test
# Run the CSS installer
FROM builder AS pkg-installer-root
ARG PKG_FILENAME
COPY $PKG_FILENAME /pkg.run
RUN chmod +x /pkg.run
RUN mkdir -p /opt/Cosmotech/css
RUN /pkg.run install --confirm-command --accept-licenses --root /opt/Cosmotech/css
ARG PKG_RELEASE_VERSION
# The final image, based on the builder, with the CSS binaries copied from the pkg-installer-root stage
FROM builder
ENV PATH=$PATH:/opt/Cosmotech/css/bin \
LC_ALL=C
COPY --from=pkg-installer-root /opt/Cosmotech/css /opt/Cosmotech/css
# Get the content brewery_sample_solution repository
WORKDIR /home/
COPY --from=workspace brewery_sample_solution/ /home/brewery_sample_solution/
WORKDIR /home/brewery_sample_solution/
RUN rm -rf .git .gitignore Generated
# Config Tooling installation and symlinks directories
WORKDIR /home/
RUN mkdir -p /home/Tooling /home/ToolingBins
ENV PATH="/home/ToolingBins:${PATH}"
# Install Git
RUN apt update && apt install -y --no-install-recommends git
# Add git to ToolingBins
WORKDIR /home/ToolingBins/
RUN ln -s /usr/bin/git git
# Install Docker as in https://docs.docker.com/engine/install/debian/
# Add Docker's official GPG key:
RUN apt update && \
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
RUN tee /etc/apt/sources.list.d/docker.sources > /dev/null <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "$VERSION_CODENAME")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
# Install the Docker packages
RUN apt update && apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Allow running systemctl inside the container, as in https://shamsfiroz.medium.com/running-inside-a-docker-container-a-practical-guide-cf7b31195575
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/sbin/init"]
# Add docker to ToolingBins
WORKDIR /home/ToolingBins/
RUN ln -s /usr/bin/docker docker
# Install Babylon
RUN python3 -m venv /home/.babylonenv
RUN /home/.babylonenv/bin/pip install git+https://github.com/Cosmo-Tech/Babylon.git@5.3.0
# Add babylon to ToolingBins
WORKDIR /home/ToolingBins/
RUN ln -s /home/.babylonenv/bin/babylon babylon
# Install kubectl as in https://kubernetes.io/docs/tasks/tools/install-kubectl-linux
WORKDIR /home/Tooling/
# Download the public signing key for the Kubernetes package repositories:
RUN curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
RUN chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg
# Add the appropriate Kubernetes apt repository:
RUN echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list
RUN chmod 644 /etc/apt/sources.list.d/kubernetes.list
# Update apt package index, then install kubectl:
RUN apt update && apt install -y kubectl
# Add kubectl to ToolingBins
WORKDIR /home/ToolingBins/
RUN ln -s /usr/bin/kubectl kubectl
# Install Azure CLI as in https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt
# Launch the script maintained by the Azure CLI team:
RUN curl -fsSL 'https://azurecliprod.blob.core.windows.net/$root/deb_install.sh' | bash
# Add az to ToolingBins
WORKDIR /home/ToolingBins/
RUN ln -s /usr/bin/az az
# Install Terraform as in https://developer.hashicorp.com/terraform/install
WORKDIR /home/Tooling/
# Add HashiCorp repository
RUN wget -O - https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list
# Install Terraform
RUN apt update && apt install -y terraform
# Add terraform to ToolingBins
WORKDIR /home/ToolingBins/
RUN ln -s /usr/bin/terraform terraform
# Clean after installation
RUN rm -rf /var/lib/apt/lists/* \
&& apt-get autopurge -y \
&& apt-get clean
# Create a volume for shared data between the host and the container
RUN mkdir -p /home/bma_babylon_folder
VOLUME /home/bma_babylon_folder
# Display installed versions as a basic check that the tools are correctly installed and available in the PATH
WORKDIR /home/
RUN echo $(git version)
RUN echo $(docker --version)
RUN echo $(babylon --version)
RUN echo $(kubectl version --client)
RUN echo $(az --version)
RUN echo $(terraform version)
RUN echo $(csm --version)