-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile-ci
151 lines (130 loc) · 4.51 KB
/
Dockerfile-ci
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
FROM ubuntu:24.04
LABEL org.opencontainers.image.vendor="synetics GmbH"
LABEL org.opencontainers.image.title="i-doit knowledge base"
LABEL org.opencontainers.image.description="DevOps environment"
LABEL org.opencontainers.image.documentation="https://kb.i-doit.com/"
ARG DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
RUN apt-get update; \
apt-get full-upgrade -y; \
apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
git \
gnupg \
locales \
lsb-release \
openssl \
python3 \
python3-apt \
python3-dev \
python3-pip \
python3-setuptools \
python3-venv \
tar \
;\
apt-get clean; \
rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Run this container as current host user:
ARG USER_ID=1000
ARG GROUP_ID=1000
RUN touch /var/mail/ubuntu; \
chown ubuntu /var/mail/ubuntu; \
userdel -r ubuntu; \
groupadd -g "${GROUP_ID}" docs; \
useradd -l -u "${USER_ID}" -g "${GROUP_ID}" docs; \
install -d -m 0750 -o docs -g docs /home/docs; \
chown "${USER_ID}":"${GROUP_ID}" -R /home/docs
WORKDIR /tmp/
# Node.js and NPM:
ARG NODE_VERSION=20.16.0
ARG NPM_VERSION=10.9.0
RUN curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n \
-o /usr/local/bin/n; \
chmod 0755 /usr/local/bin/n; \
n "$NODE_VERSION"; \
npm install -g "npm@$NPM_VERSION"; \
npm completion > /etc/bash_completion.d/npm
# hadolint:
ARG HADOLINT_VERSION=2.12.0
RUN curl -OfsSL \
"https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VERSION}/hadolint-Linux-x86_64"; \
install -m 0755 -o root -g root hadolint-Linux-x86_64 /usr/local/bin/hadolint; \
rm hadolint-Linux-x86_64
# Docker:
ARG DOCKER_VERSION_BRANCH=23
ARG DOCKER_GROUP_ID=998
RUN groupadd -g "${DOCKER_GROUP_ID}" docker; \
curl -fsSL \
https://download.docker.com/linux/ubuntu/gpg | \
gpg --dearmor > /etc/apt/keyrings/docker.gpg; \
{ \
echo "Enabled: yes"; \
echo "Types: deb"; \
echo "Architectures: amd64"; \
echo "URIs: https://download.docker.com/linux/ubuntu"; \
echo "Suites: $(lsb_release -cs)"; \
echo "Components: stable"; \
echo "Signed-By: /etc/apt/keyrings/docker.gpg"; \
} >> /etc/apt/sources.list.d/docker.sources; \
apt-get update; \
apt-get install -y --no-install-recommends \
docker-ce \
docker-ce-cli \
containerd.io \
;\
{ \
echo "Package: docker-ce*"; \
echo "Pin: version ${DOCKER_VERSION_BRANCH}.*"; \
echo "Pin-Priority: 999"; \
} >> /etc/apt/preferences.d/docker; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
usermod -a -G docker docs; \
touch /var/run/docker.sock; \
chown root:docker /var/run/docker.sock
# Docker Compose:
ARG DOCKER_COMPOSE_VERSION=2.23.0
RUN curl -OfsSL \
"https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64"; \
curl -OfsSL \
"https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/checksums.txt"; \
sha256sum --check --strict --ignore-missing \
checksums.txt; \
mkdir -p /usr/libexec/docker/cli-plugins/; \
chmod 0755 /usr/libexec/docker/cli-plugins/; \
install -m 0755 -o root -g root docker-compose-linux-x86_64 /usr/libexec/docker/cli-plugins/docker-compose; \
rm \
docker-compose-linux-x86_64 \
checksums.txt
# editorconfig-checker (ec):
ARG EC_VERSION=2.7.2
RUN curl -OfsSL \
"https://github.com/editorconfig-checker/editorconfig-checker/releases/download/${EC_VERSION}/ec-linux-amd64.tar.gz"; \
tar -xzf ec-linux-amd64.tar.gz; \
install -m 755 -o root -g root bin/ec-linux-amd64 /usr/local/bin/ec; \
rm -r \
ec-linux-amd64.tar.gz \
bin/
# Upgrade pip:
RUN dpkg -r --force-depends python3-wheel \
; \
pip3 install --upgrade --no-cache-dir --break-system-packages \
setuptools \
wheel
# pip (common):
COPY requirements.txt /tmp/
RUN pip3 install --upgrade --no-cache-dir --break-system-packages --requirement requirements.txt; \
rm requirements.txt \
; \
ln -s /usr/bin/python3 /usr/bin/python
RUN echo "source /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc
ENV PATH="/home/docs/.local/bin:/docs/node_modules/.bin:${PATH}"
WORKDIR /docs
USER docs
CMD ["bash"]