-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
150 lines (125 loc) · 5 KB
/
Dockerfile
File metadata and controls
150 lines (125 loc) · 5 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
FROM debian:13.4-slim@sha256:109e2c65005bf160609e4ba6acf7783752f8502ad218e298253428690b9eaa4b AS base
# We need those in the builder before setting up apt repos and we need
# those in the final image, so keep them in the base
RUN set -ex \
&& apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
ca-certificates \
curl \
gnupg \
unzip \
&& apt-get autoremove --assume-yes --purge \
&& apt-get clean --assume-yes
FROM base AS builder
ARG GOLANG_VERSION=1.26.3 # renovate: packageName=golang datasource=golang-version
ARG GOLANGCI_LINT_VERSION=2.12.2 # renovate: packageName=golangci/golangci-lint datasource=github-releases
ARG GOYQ_VERSION=4.53.2 # renovate: packageName=mikefarah/yq datasource=github-releases
ARG HELM_VERSION=4.1.4 # renovate: packageName=helm/helm datasource=github-releases
ARG NODE_VERSION=24.15.0 # renovate: packageName=node datasource=node-version
ARG ORAS_VERSION=1.3.2 # renovate: packageName=oras-project/oras datasource=github-releases
ARG VAULT_VERSION=2.0.0 # renovate: packageName=hashicorp/vault datasource=github-releases
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
# Install uv and uvx from the OCI image
COPY --from=ghcr.io/astral-sh/uv:0.11.12@sha256:3a59a3cdd5f7c217faa36e32dbc7fddbb0412889c2a0a5229f6d790e5a019dd7 \
/uv /uvx \
/rootfs/usr/local/bin/
# Install pnpm from the OCI image
COPY --from=ghcr.io/luzifer-docker/pnpm:v11.0.8@sha256:8773414fc480b4477adc93d03bbd7ab621e5851d0fa9841f77d6ebe6b4d11367 \
/ \
/rootfs/
# Install kubectl from the OCI image
COPY --from=ghcr.io/luzifer-docker/kubectl:v1.36.0@sha256:d562d5e6b15fcf38626f81c5696ff1e47b281aa1800ce946e4a1ec6f9e3497bc \
/usr/local/bin/kubectl \
/rootfs/usr/local/bin/
# Setup APT repos
RUN <<-EOF
CODENAME="$(. /etc/os-release && echo "$VERSION_CODENAME")"
# Docker
curl -fsSL https://download.docker.com/linux/debian/gpg |
install -Dm0644 /dev/stdin /rootfs/etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian ${CODENAME} stable" |
install -Dm0644 /dev/stdin /rootfs/etc/apt/sources.list.d/docker.list
# NodeJS through NodeSource
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key |
gpg --dearmor -o /rootfs/etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_VERSION%%.*}.x nodistro main" |
install -Dm0644 /dev/stdin /rootfs/etc/apt/sources.list.d/nodesource.list
# Trivy
curl -sSfL https://aquasecurity.github.io/trivy-repo/deb/public.key |
gpg --dearmor -o /rootfs/etc/apt/keyrings/trivy.gpg
echo "deb [signed-by=/etc/apt/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb generic main" |
install -Dm0644 /dev/stdin /rootfs/etc/apt/sources.list.d/trivy.list
EOF
# Install Golang
RUN <<-EOF
curl -sSfL "https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz" | \
tar -C /rootfs/usr/local -xz
EOF
# Install golangci-lint
RUN <<-EOF
curl -sSfL "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" | \
tar -C /rootfs/usr/local/bin -xz --strip-components=1 --wildcards '*/golangci-lint'
EOF
# Install go-yq
RUN <<-EOF
curl -sSfL "https://github.com/mikefarah/yq/releases/download/v${GOYQ_VERSION}/yq_linux_amd64" |
install -Dm0755 /dev/stdin /rootfs/usr/local/bin/yq
EOF
# Install Helm
RUN <<-EOF
curl -sSfL "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" |
tar -C /rootfs/usr/local/bin -xz --strip-components=1 --wildcards '*/helm'
EOF
# Install oras
RUN <<-EOF
curl -sSfL "https://github.com/oras-project/oras/releases/download/v${ORAS_VERSION}/oras_${ORAS_VERSION}_linux_amd64.tar.gz" |
tar -C /rootfs/usr/local/bin -xz oras
EOF
# Install vault
RUN <<-EOF
vault_tmp=$(mktemp -d)
curl -sSfLo ${vault_tmp}/vault.zip "https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip"
unzip ${vault_tmp}/vault.zip vault -d /rootfs/usr/local/bin
EOF
# Install base files from local repo
COPY rootfs/ /rootfs/
FROM base
ENV DEBIAN_FRONTEND=noninteractive \
GOPATH=/go \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin
# Install compiled rootfs
COPY --from=builder /rootfs/ /
# Install the final list of packages
RUN set -ex \
&& apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
ansible-core \
build-essential \
diffutils \
gawk \
git \
git-crypt \
git-lfs \
less \
make \
openssh-client \
pkg-config \
rsync \
sudo \
tar \
zip \
\
docker-buildx-plugin \
docker-ce-cli \
nodejs \
trivy \
&& apt-get autoremove --assume-yes --purge \
&& apt-get clean --assume-yes
# Create runner user
RUN useradd \
--create-home \
--home-dir=/home/ci \
--shell=/usr/bin/bash \
--uid=1000 \
--user-group \
ci